1 /* Copyright (C) 2007-2012 Red Hat, Inc.
2 This file is part of elfutils.
3 Written by Ulrich Drepper <drepper@redhat.com>, 2007.
5 This file 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 3 of the License, or
8 (at your option) any later version.
10 elfutils is distributed in the hope that it will be useful, but
11 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.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
30 #include <sys/types.h>
33 /* State of -D/-U flags. */
34 extern bool arlib_deterministic_output;
36 /* For options common to ar and ranlib. */
37 extern const struct argp_child arlib_argp_children[];
40 /* Maximum length of a file name that fits directly into the ar header.
41 We cannot use the final byte since a / goes there. */
42 #define MAX_AR_NAME_LEN (sizeof (((struct ar_hdr *) NULL)->ar_name) - 1)
45 /* Words matching in size to archive header. */
46 #define AR_HDR_WORDS (sizeof (struct ar_hdr) / sizeof (uint32_t))
49 #if __BYTE_ORDER == __LITTLE_ENDIAN
50 # define le_bswap_32(val) bswap_32 (val)
52 # define le_bswap_32(val) (val)
56 /* Symbol table type. */
59 /* Symbol table handling. */
60 struct obstack symsoffob;
61 struct obstack symsnameob;
67 /* Long filename handling. */
68 struct obstack longnamesob;
74 /* Global variable with symbol table. */
75 extern struct arlib_symtab symtab;
78 /* Initialize ARLIB_SYMTAB structure. */
79 extern void arlib_init (void);
81 /* Finalize ARLIB_SYMTAB content. */
82 extern void arlib_finalize (void);
84 /* Free resources for ARLIB_SYMTAB. */
85 extern void arlib_fini (void);
87 /* Add symbols from ELF with value OFFSET to the symbol table SYMTAB. */
88 extern void arlib_add_symbols (Elf *elf, const char *arfname,
89 const char *membername, off_t off);
91 /* Add name a file offset of a symbol. */
92 extern void arlib_add_symref (const char *symname, off_t symoff);
94 /* Add long file name FILENAME of length FILENAMELEN to the symbol table
95 SYMTAB. Return the offset into the long file name table. */
96 extern long int arlib_add_long_name (const char *filename, size_t filenamelen);