xref: /dflybsd-src/contrib/gdb-7/include/aout/ranlib.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /* ranlib.h -- archive library index member definition for GNU.
286d7f5d3SJohn Marino    Copyright 1990, 1991, 2010 Free Software Foundation, Inc.
386d7f5d3SJohn Marino 
486d7f5d3SJohn Marino    This program is free software; you can redistribute it and/or modify
586d7f5d3SJohn Marino    it under the terms of the GNU General Public License as published by
686d7f5d3SJohn Marino    the Free Software Foundation; either version 3 of the License, or
786d7f5d3SJohn Marino    (at your option) any later version.
886d7f5d3SJohn Marino 
986d7f5d3SJohn Marino    This program is distributed in the hope that it will be useful,
1086d7f5d3SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
1186d7f5d3SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1286d7f5d3SJohn Marino    GNU General Public License for more details.
1386d7f5d3SJohn Marino 
1486d7f5d3SJohn Marino    You should have received a copy of the GNU General Public License
1586d7f5d3SJohn Marino    along with this program; if not, write to the Free Software
1686d7f5d3SJohn Marino    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
1786d7f5d3SJohn Marino    MA 02110-1301, USA.  */
1886d7f5d3SJohn Marino 
1986d7f5d3SJohn Marino /* The Symdef member of an archive contains two things:
2086d7f5d3SJohn Marino    a table that maps symbol-string offsets to file offsets,
2186d7f5d3SJohn Marino    and a symbol-string table.  All the symbol names are
2286d7f5d3SJohn Marino    run together (each with trailing null) in the symbol-string
2386d7f5d3SJohn Marino    table.  There is a single longword bytecount on the front
2486d7f5d3SJohn Marino    of each of these tables.  Thus if we have two symbols,
2586d7f5d3SJohn Marino    "foo" and "_bar", that are in archive members at offsets
2686d7f5d3SJohn Marino    200 and 900, it would look like this:
2786d7f5d3SJohn Marino         16		; byte count of index table
2886d7f5d3SJohn Marino   	0		; offset of "foo" in string table
2986d7f5d3SJohn Marino   	200		; offset of foo-module in file
3086d7f5d3SJohn Marino   	4		; offset of "bar" in string table
3186d7f5d3SJohn Marino   	900		; offset of bar-module in file
3286d7f5d3SJohn Marino   	9		; byte count of string table
3386d7f5d3SJohn Marino   	"foo\0_bar\0"	; string table  */
3486d7f5d3SJohn Marino 
3586d7f5d3SJohn Marino #define	RANLIBMAG	"__.SYMDEF"	/* Archive file name containing index */
3686d7f5d3SJohn Marino #define	RANLIBSKEW	3		/* Creation time offset */
3786d7f5d3SJohn Marino 
3886d7f5d3SJohn Marino /* Format of __.SYMDEF:
3986d7f5d3SJohn Marino    First, a longword containing the size of the 'symdef' data that follows.
4086d7f5d3SJohn Marino    Second, zero or more 'symdef' structures.
4186d7f5d3SJohn Marino    Third, a longword containing the length of symbol name strings.
4286d7f5d3SJohn Marino    Fourth, zero or more symbol name strings (each followed by a null).  */
4386d7f5d3SJohn Marino 
4486d7f5d3SJohn Marino struct symdef
4586d7f5d3SJohn Marino   {
4686d7f5d3SJohn Marino     union
4786d7f5d3SJohn Marino       {
4886d7f5d3SJohn Marino 	unsigned long string_offset;	/* In the file */
4986d7f5d3SJohn Marino 	char *name;			/* In memory, sometimes */
5086d7f5d3SJohn Marino       } s;
5186d7f5d3SJohn Marino     /* this points to the front of the file header (AKA member header --
5286d7f5d3SJohn Marino        a struct ar_hdr), not to the front of the file or into the file).
5386d7f5d3SJohn Marino        in other words it only tells you which file to read */
5486d7f5d3SJohn Marino     unsigned long file_offset;
5586d7f5d3SJohn Marino   };
5686d7f5d3SJohn Marino 
5786d7f5d3SJohn Marino /* Compatability with BSD code */
5886d7f5d3SJohn Marino 
5986d7f5d3SJohn Marino #define	ranlib	symdef
6086d7f5d3SJohn Marino #define	ran_un	s
6186d7f5d3SJohn Marino #define	ran_strx string_offset
6286d7f5d3SJohn Marino #define	ran_name name
6386d7f5d3SJohn Marino #define	ran_off	file_offset
64