]>
Commit | Line | Data |
---|---|---|
3284fe0c | 1 | /* elfcomm.h -- include file of common code for ELF format file. |
a2c58332 | 2 | Copyright (C) 2010-2022 Free Software Foundation, Inc. |
3284fe0c L |
3 | |
4 | Originally developed by Eric Youngdale <eric@andante.jic.com> | |
5 | Modifications by Nick Clifton <nickc@redhat.com> | |
6 | ||
7 | This file is part of GNU Binutils. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 3 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with this program; if not, write to the Free Software | |
21 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA | |
22 | 02110-1301, USA. */ | |
23 | \f | |
24 | #ifndef _ELFCOMM_H | |
25 | #define _ELFCOMM_H | |
26 | ||
27 | #include "aout/ar.h" | |
28 | ||
546cb2d8 NC |
29 | extern void error (const char *, ...) ATTRIBUTE_PRINTF_1; |
30 | extern void warn (const char *, ...) ATTRIBUTE_PRINTF_1; | |
3284fe0c | 31 | |
3284fe0c L |
32 | typedef unsigned HOST_WIDEST_INT elf_vma; |
33 | ||
af2ddf69 AM |
34 | extern void (*byte_put) (unsigned char *, elf_vma, unsigned int); |
35 | extern void byte_put_little_endian (unsigned char *, elf_vma, unsigned int); | |
36 | extern void byte_put_big_endian (unsigned char *, elf_vma, unsigned int); | |
37 | ||
38 | extern elf_vma (*byte_get) (const unsigned char *, unsigned int); | |
39 | extern elf_vma byte_get_signed (const unsigned char *, unsigned int); | |
40 | extern elf_vma byte_get_little_endian (const unsigned char *, unsigned int); | |
41 | extern elf_vma byte_get_big_endian (const unsigned char *, unsigned int); | |
3284fe0c L |
42 | |
43 | #define BYTE_PUT(field, val) byte_put (field, val, sizeof (field)) | |
44 | #define BYTE_GET(field) byte_get (field, sizeof (field)) | |
45 | #define BYTE_GET_SIGNED(field) byte_get_signed (field, sizeof (field)) | |
46 | ||
47 | /* This is just a bit of syntatic sugar. */ | |
48 | #define streq(a,b) (strcmp ((a), (b)) == 0) | |
3284fe0c L |
49 | |
50 | /* Structure to hold information about an archive file. */ | |
51 | ||
52 | struct archive_info | |
53 | { | |
54 | char * file_name; /* Archive file name. */ | |
55 | FILE * file; /* Open file descriptor. */ | |
c2a7d3f5 NC |
56 | elf_vma index_num; /* Number of symbols in table. */ |
57 | elf_vma * index_array; /* The array of member offsets. */ | |
3284fe0c L |
58 | char * sym_table; /* The symbol table. */ |
59 | unsigned long sym_size; /* Size of the symbol table. */ | |
60 | char * longnames; /* The long file names table. */ | |
61 | unsigned long longnames_size; /* Size of the long file names table. */ | |
62 | unsigned long nested_member_origin; /* Origin in the nested archive of the current member. */ | |
63 | unsigned long next_arhdr_offset; /* Offset of the next archive header. */ | |
81a65eb3 AM |
64 | int is_thin_archive; /* 1 if this is a thin archive. */ |
65 | int uses_64bit_indices; /* 1 if the index table uses 64bit entries. */ | |
3284fe0c L |
66 | struct ar_hdr arhdr; /* Current archive header. */ |
67 | }; | |
68 | ||
69 | /* Return the path name for a proxy entry in a thin archive. */ | |
591f7597 | 70 | extern char *adjust_relative_path (const char *, const char *, unsigned long); |
3284fe0c L |
71 | |
72 | /* Read the symbol table and long-name table from an archive. */ | |
73 | extern int setup_archive (struct archive_info *, const char *, FILE *, | |
81a65eb3 | 74 | off_t, int, int); |
3284fe0c L |
75 | |
76 | /* Open and setup a nested archive, if not already open. */ | |
77 | extern int setup_nested_archive (struct archive_info *, const char *); | |
78 | ||
79 | /* Release the memory used for the archive information. */ | |
80 | extern void release_archive (struct archive_info *); | |
81 | ||
82 | /* Get the name of an archive member from the current archive header. */ | |
83 | ||
84 | extern char *get_archive_member_name (struct archive_info *, | |
85 | struct archive_info *); | |
86 | ||
87 | /* Get the name of an archive member at a given offset within an | |
88 | archive. */ | |
89 | ||
90 | extern char *get_archive_member_name_at (struct archive_info *, | |
91 | unsigned long, | |
92 | struct archive_info *); | |
93 | ||
94 | /* Construct a string showing the name of the archive member, qualified | |
95 | with the name of the containing archive file. */ | |
96 | ||
97 | extern char *make_qualified_name (struct archive_info *, | |
98 | struct archive_info *, | |
99 | const char *); | |
100 | ||
101 | #endif /* _ELFCOMM_H */ |