xref: /openbsd/gnu/usr.bin/binutils/include/aout/ar.h (revision 76d0caae)
1 /* archive file definition for GNU software
2 
3    Copyright 2001 Free Software Foundation, Inc.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18 
19 /* So far this is correct for BSDish archives.  Don't forget that
20    files must begin on an even byte boundary. */
21 
22 #ifndef __GNU_AR_H__
23 #define __GNU_AR_H__
24 
25 /* Note that the usual '\n' in magic strings may translate to different
26    characters, as allowed by ANSI.  '\012' has a fixed value, and remains
27    compatible with existing BSDish archives. */
28 
29 #define ARMAG  "!<arch>\012"	/* For COFF and a.out archives */
30 #define ARMAGB "!<bout>\012"	/* For b.out archives */
31 #define SARMAG 8
32 #define ARFMAG "`\012"
33 
34 /* The ar_date field of the armap (__.SYMDEF) member of an archive
35    must be greater than the modified date of the entire file, or
36    BSD-derived linkers complain.  We originally write the ar_date with
37    this offset from the real file's mod-time.  After finishing the
38    file, we rewrite ar_date if it's not still greater than the mod date.  */
39 
40 #define ARMAP_TIME_OFFSET       60
41 
42 struct ar_hdr {
43   char ar_name[16];		/* name of this member */
44   char ar_date[12];		/* file mtime */
45   char ar_uid[6];		/* owner uid; printed as decimal */
46   char ar_gid[6];		/* owner gid; printed as decimal */
47   char ar_mode[8];		/* file mode, printed as octal   */
48   char ar_size[10];		/* file size, printed as decimal */
49   char ar_fmag[2];		/* should contain ARFMAG */
50 };
51 
52 #endif /* __GNU_AR_H__ */
53