3 objtype, readobj, objtraverse, isar, nextar, readar \- object file interpretation functions
15 int objtype(Biobuf *bp, char **name)
18 int readobj(Biobuf *bp, int objtype)
21 void objtraverse(void(*)(Sym*, void*), void*)
27 int nextar(Biobuf *bp, int offset, char *buf)
30 int readar(Biobuf *bp, int objtype, vlong end, int doautos)
32 These functions provide machine-independent access to object files
33 in a directory or an archive.
37 describe additional library functions
38 for interpreting executable files and executing images.
40 Object files contain no formal symbol table; instead, references
41 to symbols must be extracted from the encoded object representation
42 and resolved. The resulting symbol information is loaded
43 into a dummy symbol table where it is available for processing by an
44 application. The organization of the dummy symbol
46 to that produced by the loader and described in
52 data structures defining the name, type and relative offset of
56 reads the header at the current position of the
61 to see if it is an intermediate object file.
62 If it is, a code indicating the architecture type of the file
63 is returned and the second argument, if it is non-zero,
64 is set pointing to a string describing the type of the file.
65 If the header does not indicate an object file,
67 The header may be at the start of an object
68 file or at the beginning of an archive member. The
69 file is rewound to its starting
70 position after decoding the header.
73 constructs a symbol table for the object file associated with
75 The second argument contains the type code produced by
78 The file must be positioned at the start of the object file.
81 destroys the symbol definitions for any previous file.
84 scans the symbol table previously built by
89 requires two arguments:
90 the address of a call-back function and a
91 generic pointer. The call-back function
92 is invoked once for each symbol in the symbol table with
95 data structure as the first argument and the
96 generic pointer as the second.
99 reads the header at the current point in the file
102 and returns 1 if it is an archive or zero otherwise.
103 The file is positioned at the end of the archive
104 header and at the beginning of the first member of the archive.
107 extracts information describing the archive member stored
110 in the file associated with
112 If the header describing the member can be
113 extracted and decoded, the size of the member is
114 returned. Adding this value to
116 yields the offset of the beginning of the next member
117 in the archive. On return the input file is positioned
118 at the end of the member header
119 and the name of the member is stored in
124 If there are no more members,
126 returns zero; a negative return indicates a missing
130 constructs the symbol table of the object file stored
131 at the current position in the archive associated with
133 This function operates exactly as
135 the only difference is the extra argument,
137 specifying the offset to the beginning of the
138 next member in the archive.
140 leaves the file positioned at that point.