aboutsummaryrefslogtreecommitdiff
path: root/binutils/elfcomm.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-11-23 07:33:29 +1030
committerAlan Modra <amodra@gmail.com>2022-11-23 07:53:13 +1030
commit26c527e62e701ae256c1af243ec9d73e5560bd48 (patch)
treea44df4341fb9c64b305f0fa86ef4df653c3d8f48 /binutils/elfcomm.h
parent63cf857e24be8e657dd2d3197da5c01a0f590d27 (diff)
downloadgdb-26c527e62e701ae256c1af243ec9d73e5560bd48.zip
gdb-26c527e62e701ae256c1af243ec9d73e5560bd48.tar.gz
gdb-26c527e62e701ae256c1af243ec9d73e5560bd48.tar.bz2
Don't use "long" in readelf for file offsets
The aim here is to improve readelf handling of large 64-bit object files on LLP64 hosts (Windows) where long is only 32 bits. The patch changes more than just file offsets. Addresses and sizes are also changed to avoid "long". Most places get to use uint64_t even where size_t may be more appropriate, because that allows some overflow checks to be implemented easily (*alloc changes). * dwarf.c (cmalloc, xcmalloc, xcrealloc, xcalloc2): Make nmemb parameter uint64_t. * dwarf.h: Update prototypes. (struct dwarf_section): Make num_relocs uint64_t. * elfcomm.c (setup_archive): Update error format. * elfcomm.h (struct archive_info): Make sym_size, longnames_size, nested_member_origin, next_arhdr_offset uint64_t. * readelf.c (struct filedata): Make archive_file_offset, archive_file_size, string_table_length, dynamic_addr, dynamic_nent, dynamic_strings_length, num_dynamic_syms, dynamic_syminfo_offset uint64_t. (many functions): Replace uses of "unsigned long" with "uint64_t" or "size_t".
Diffstat (limited to 'binutils/elfcomm.h')
-rw-r--r--binutils/elfcomm.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/binutils/elfcomm.h b/binutils/elfcomm.h
index bab46b0..54ac4b3 100644
--- a/binutils/elfcomm.h
+++ b/binutils/elfcomm.h
@@ -49,19 +49,19 @@ extern uint64_t byte_get_big_endian (const unsigned char *, unsigned int);
struct archive_info
{
- char * file_name; /* Archive file name. */
- FILE * file; /* Open file descriptor. */
- uint64_t index_num; /* Number of symbols in table. */
- uint64_t * index_array; /* The array of member offsets. */
- char * sym_table; /* The symbol table. */
- unsigned long sym_size; /* Size of the symbol table. */
- char * longnames; /* The long file names table. */
- unsigned long longnames_size; /* Size of the long file names table. */
- unsigned long nested_member_origin; /* Origin in the nested archive of the current member. */
- unsigned long next_arhdr_offset; /* Offset of the next archive header. */
- int is_thin_archive; /* 1 if this is a thin archive. */
- int uses_64bit_indices; /* 1 if the index table uses 64bit entries. */
- struct ar_hdr arhdr; /* Current archive header. */
+ char *file_name; /* Archive file name. */
+ FILE *file; /* Open file descriptor. */
+ uint64_t index_num; /* Number of symbols in table. */
+ uint64_t *index_array; /* The array of member offsets. */
+ char *sym_table; /* The symbol table. */
+ uint64_t sym_size; /* Size of the symbol table. */
+ char *longnames; /* The long file names table. */
+ uint64_t longnames_size; /* Size of the long file names table. */
+ uint64_t nested_member_origin; /* Origin in the nested archive of the current member. */
+ uint64_t next_arhdr_offset; /* Offset of the next archive header. */
+ int is_thin_archive; /* 1 if this is a thin archive. */
+ int uses_64bit_indices; /* 1 if the index table uses 64bit entries. */
+ struct ar_hdr arhdr; /* Current archive header. */
};
/* Return the path name for a proxy entry in a thin archive. */