1/* ranlib.h -- archive library index member definition for GNU.
2   Copyright (C) 1990-2022 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 3 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,
17   MA 02110-1301, USA.  */
18
19/* The Symdef member of an archive contains two things:
20   a table that maps symbol-string offsets to file offsets,
21   and a symbol-string table.  All the symbol names are
22   run together (each with trailing null) in the symbol-string
23   table.  There is a single longword bytecount on the front
24   of each of these tables.  Thus if we have two symbols,
25   "foo" and "_bar", that are in archive members at offsets
26   200 and 900, it would look like this:
27        16		; byte count of index table
28  	0		; offset of "foo" in string table
29  	200		; offset of foo-module in file
30  	4		; offset of "bar" in string table
31  	900		; offset of bar-module in file
32  	9		; byte count of string table
33  	"foo\0_bar\0"	; string table  */
34
35#define	RANLIBMAG	"__.SYMDEF"	/* Archive file name containing index */
36#define	RANLIBSKEW	3		/* Creation time offset */
37
38/* Format of __.SYMDEF:
39   First, a longword containing the size of the 'symdef' data that follows.
40   Second, zero or more 'symdef' structures.
41   Third, a longword containing the length of symbol name strings.
42   Fourth, zero or more symbol name strings (each followed by a null).  */
43
44struct symdef
45  {
46    union
47      {
48	unsigned long string_offset;	/* In the file */
49	char *name;			/* In memory, sometimes */
50      } s;
51    /* this points to the front of the file header (AKA member header --
52       a struct ar_hdr), not to the front of the file or into the file).
53       in other words it only tells you which file to read */
54    unsigned long file_offset;
55  };
56
57/* Compatability with BSD code */
58
59#define	ranlib	symdef
60#define	ran_un	s
61#define	ran_strx string_offset
62#define	ran_name name
63#define	ran_off	file_offset
64