Lines Matching +full:segment +full:- +full:1 +full:a

10 .\" 1. Redistributions of source code must retain the above copyright
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 .Nm a.out
48 A binary file consists of up to 7 sections.
50 .Bl -tag -width "text relocations"
53 to load a binary file into memory and execute it,
55 .Xr ld 1
56 to combine a binary file with other binary files.
58 .It text segment
60 that are loaded into memory when a program executes.
61 May be loaded read-only.
62 .It data segment
66 to update pointers in the text segment when combining binary files.
68 Like the text relocation section, but for data segment pointers.
81 .Bd -literal -offset indent
95 .Bl -tag -width a_trsize
97 This field is stored in host byte-order.
98 It has a number of sub-components accessed by the macros
108 returns a few flags:
109 .Bl -tag -width EX_DYNAMIC
111 indicates that the executable requires the services of the run-time link editor.
116 .Xr as 1
118 .Sq -k
120 .Xr ld 1
124 If both EX_DYNAMIC and EX_PIC are set, the object file is a position independent
125 executable image (e.g.\& a shared library), which is to be loaded into the
126 process address space by the run-time link editor.
130 returns the machine-id.
137 .Bl -tag -width ZMAGIC
146 However, the kernel loads the text into read-only memory
151 The header, text segment and data segment are all
152 padded by the link editor to a multiple of the page size.
153 Pages that the kernel loads from the text segment are read-only,
154 while pages from the data segment are writable.
157 Contains the size of the text segment in bytes.
159 Contains the size of the data segment in bytes.
162 .Sq bss segment
165 after the data segment.
167 appears to follow the data segment and initially reads as zeroes.
188 .Bl -tag -width N_BADMAG(exec)
192 field does not contain a recognized value.
194 The byte offset in the binary file of the beginning of the text segment.
201 Relocation records have a standard format which
205 .Bd -literal -offset indent
209 r_pcrel : 1,
211 r_extern : 1,
212 r_baserel : 1,
213 r_jmptable : 1,
214 r_relative : 1,
215 r_copy : 1;
222 .Bl -tag -width r_symbolnum
224 Contains the byte offset of a pointer that needs to be link-edited.
225 Text relocation offsets are reckoned from the start of the text segment,
226 and data relocation offsets from the start of the data segment.
230 Contains the ordinal number of a symbol structure
233 a byte offset).
241 the link editor assumes that it is updating a pointer
242 that is part of a machine code instruction using pc-relative addressing.
247 0 for 1-byte displacements, 1 for 2-byte displacements,
248 2 for 4-byte displacements.
251 the link editor must use a symbol address to update the pointer.
258 rather than changes in the value of a symbol (except when
267 what segment the relocated pointer points into.
272 At run-time, the entry in the Global Offset Table at this offset is set to
279 If set, this relocation is relative to the (run-time) load address of the
280 image this object file is going to be a part of.
284 If set, this relocation record identifies a symbol whose contents should
287 The copying is done by the run-time link-editor from a suitable data
288 item in a shared object.
292 Since the link-editor adjusts addresses,
293 a symbol's name must be used to stand for its address
295 Symbols consist of a fixed-length record in the symbol table
296 and a variable-length name in the string table.
300 .Bd -literal -offset indent
314 .Bl -tag -width n_un.n_strx
316 Contains a byte offset into the string table
318 When a program accesses a symbol table with the
323 field, which is a pointer to the string in memory.
329 field is broken down into three sub-fields using bitmasks.
338 .Bl -tag -width N_TEXT
343 As a special case, if the
345 field is nonzero and no binary file in the link-edit defines this symbol,
346 the link-editor will resolve this symbol to an address
347 in the bss segment,
357 A text symbol.
358 This symbol's value is a text address and
361 A data symbol; similar to
369 A bss symbol; like text or data symbols but
372 A filename symbol.
374 the other symbols from a binary file when
378 Filename symbols are not needed for link-editing or loading,
386 .Xr gdb 1 Pq Pa ports/devel/gdb ;
404 associates the symbol with a callable function, while
407 either the text or the data segment.
409 .Xr ld 1
423 length followed by null-terminated symbol strings.
426 is always 4 on 32-bit machines.
428 .Xr as 1 ,
429 .Xr gdb 1 Pq Pa ports/devel/gdb ,
430 .Xr ld 1 ,
448 architecture a binary will execute on
450 Even with a machine identifier,
453 header is machine-dependent.