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