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