diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-05-15 10:29:03 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-05-15 10:29:03 -0700 |
commit | fd8008d83ce379a8d3f3bb9c3b1a723e16c401d4 (patch) | |
tree | 90249d6441d0f4e414aca6958fb252bf73b6fadf /binutils/readelf.c | |
parent | 5db04b0965e3e7a9344a93de22caae3c111de2cc (diff) | |
download | gdb-fd8008d83ce379a8d3f3bb9c3b1a723e16c401d4.zip gdb-fd8008d83ce379a8d3f3bb9c3b1a723e16c401d4.tar.gz gdb-fd8008d83ce379a8d3f3bb9c3b1a723e16c401d4.tar.bz2 |
Change pointers from char * to unsigned char *
GCC 4.2 complaints:
cc1: warnings being treated as errors
binutils/readelf.c:12057: warning: dereferencing type-punned pointer will break strict-aliasing rules
This patch silences this GCC warning.
* readelf.c (dump_section_as_strings): Change pointers from
char * to unsigned char *.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index 4bb31eb..6369aa9 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -12004,13 +12004,14 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file) { Elf_Internal_Shdr * relsec; bfd_size_type num_bytes; - char * data; - char * end; - char * real_start; - char * start; + unsigned char * data; + unsigned char * end; + unsigned char * real_start; + unsigned char * start; bfd_boolean some_strings_shown; - real_start = start = get_section_contents (section, file); + real_start = start = (unsigned char *) get_section_contents (section, + file); if (start == NULL) return; num_bytes = section->sh_size; @@ -12054,11 +12055,11 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file) } if (uncompressed_size - && uncompress_section_contents ((unsigned char **) & start, + && uncompress_section_contents (& start, uncompressed_size, & new_size)) num_bytes = new_size; } - + /* If the section being dumped has relocations against it the user might be expecting these relocations to have been applied. Check for this case and issue a warning message in order to avoid confusion. @@ -12102,9 +12103,9 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file) #endif if (maxlen > 0) { - print_symbol ((int) maxlen, data); + print_symbol ((int) maxlen, (const char *) data); putchar ('\n'); - data += strnlen (data, maxlen); + data += strnlen ((const char *) data, maxlen); } else { |