1*fae548d3Szrj /* ranlib.h -- archive library index member definition for GNU. 2*fae548d3Szrj Copyright (C) 1990-2020 Free Software Foundation, Inc. 3*fae548d3Szrj 4*fae548d3Szrj This program is free software; you can redistribute it and/or modify 5*fae548d3Szrj it under the terms of the GNU General Public License as published by 6*fae548d3Szrj the Free Software Foundation; either version 3 of the License, or 7*fae548d3Szrj (at your option) any later version. 8*fae548d3Szrj 9*fae548d3Szrj This program is distributed in the hope that it will be useful, 10*fae548d3Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of 11*fae548d3Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*fae548d3Szrj GNU General Public License for more details. 13*fae548d3Szrj 14*fae548d3Szrj You should have received a copy of the GNU General Public License 15*fae548d3Szrj along with this program; if not, write to the Free Software 16*fae548d3Szrj Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 17*fae548d3Szrj MA 02110-1301, USA. */ 18*fae548d3Szrj 19*fae548d3Szrj /* The Symdef member of an archive contains two things: 20*fae548d3Szrj a table that maps symbol-string offsets to file offsets, 21*fae548d3Szrj and a symbol-string table. All the symbol names are 22*fae548d3Szrj run together (each with trailing null) in the symbol-string 23*fae548d3Szrj table. There is a single longword bytecount on the front 24*fae548d3Szrj of each of these tables. Thus if we have two symbols, 25*fae548d3Szrj "foo" and "_bar", that are in archive members at offsets 26*fae548d3Szrj 200 and 900, it would look like this: 27*fae548d3Szrj 16 ; byte count of index table 28*fae548d3Szrj 0 ; offset of "foo" in string table 29*fae548d3Szrj 200 ; offset of foo-module in file 30*fae548d3Szrj 4 ; offset of "bar" in string table 31*fae548d3Szrj 900 ; offset of bar-module in file 32*fae548d3Szrj 9 ; byte count of string table 33*fae548d3Szrj "foo\0_bar\0" ; string table */ 34*fae548d3Szrj 35*fae548d3Szrj #define RANLIBMAG "__.SYMDEF" /* Archive file name containing index */ 36*fae548d3Szrj #define RANLIBSKEW 3 /* Creation time offset */ 37*fae548d3Szrj 38*fae548d3Szrj /* Format of __.SYMDEF: 39*fae548d3Szrj First, a longword containing the size of the 'symdef' data that follows. 40*fae548d3Szrj Second, zero or more 'symdef' structures. 41*fae548d3Szrj Third, a longword containing the length of symbol name strings. 42*fae548d3Szrj Fourth, zero or more symbol name strings (each followed by a null). */ 43*fae548d3Szrj 44*fae548d3Szrj struct symdef 45*fae548d3Szrj { 46*fae548d3Szrj union 47*fae548d3Szrj { 48*fae548d3Szrj unsigned long string_offset; /* In the file */ 49*fae548d3Szrj char *name; /* In memory, sometimes */ 50*fae548d3Szrj } s; 51*fae548d3Szrj /* this points to the front of the file header (AKA member header -- 52*fae548d3Szrj a struct ar_hdr), not to the front of the file or into the file). 53*fae548d3Szrj in other words it only tells you which file to read */ 54*fae548d3Szrj unsigned long file_offset; 55*fae548d3Szrj }; 56*fae548d3Szrj 57*fae548d3Szrj /* Compatability with BSD code */ 58*fae548d3Szrj 59*fae548d3Szrj #define ranlib symdef 60*fae548d3Szrj #define ran_un s 61*fae548d3Szrj #define ran_strx string_offset 62*fae548d3Szrj #define ran_name name 63*fae548d3Szrj #define ran_off file_offset 64