summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils-2.17
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2011-11-12 16:51:21 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2011-11-12 16:51:21 +0000
commit7968043e9f742576cdcdecb7cacee324e60f012e (patch)
treeb079912e0b35dc4e6c19b2bed1cc2c0694606afc /gnu/usr.bin/binutils-2.17
parent2f22450e37a982c20d85918b3587509d161fda1a (diff)
Satisfy -Wbounded.
Patch gyped from nicm@'s and jasper@'s work on the gdb port.
Diffstat (limited to 'gnu/usr.bin/binutils-2.17')
-rw-r--r--gnu/usr.bin/binutils-2.17/binutils/readelf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils-2.17/binutils/readelf.c b/gnu/usr.bin/binutils-2.17/binutils/readelf.c
index fa6dcf968b4..78a417a06d6 100644
--- a/gnu/usr.bin/binutils-2.17/binutils/readelf.c
+++ b/gnu/usr.bin/binutils-2.17/binutils/readelf.c
@@ -8861,8 +8861,10 @@ get_file_header (FILE *file)
if (is_32bit_elf)
{
Elf32_External_Ehdr ehdr32;
+ /* Temporary var to prevent the GCC -Wbounded checker from firing. */
+ void *tmp = &ehdr32.e_type[0];
- if (fread (ehdr32.e_type, sizeof (ehdr32) - EI_NIDENT, 1, file) != 1)
+ if (fread (tmp, sizeof (ehdr32) - EI_NIDENT, 1, file) != 1)
return 0;
elf_header.e_type = BYTE_GET (ehdr32.e_type);
@@ -8882,6 +8884,8 @@ get_file_header (FILE *file)
else
{
Elf64_External_Ehdr ehdr64;
+ /* Temporary var to prevent the GCC -Wbounded checker from firing. */
+ void *tmp = &ehdr64.e_type[0];
/* If we have been compiled with sizeof (bfd_vma) == 4, then
we will not be able to cope with the 64bit data found in
@@ -8894,7 +8898,7 @@ get_file_header (FILE *file)
return 0;
}
- if (fread (ehdr64.e_type, sizeof (ehdr64) - EI_NIDENT, 1, file) != 1)
+ if (fread (tmp, sizeof (ehdr64) - EI_NIDENT, 1, file) != 1)
return 0;
elf_header.e_type = BYTE_GET (ehdr64.e_type);