aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-10-18 04:34:36 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2016-10-18 04:36:55 +0100
commit61034b0b6acc6ff72def5f5ecdbe628edc5d67ea (patch)
treeb6d185b25f8c5a3f29774fc5cb738948681fe589
parentc48182bfe408e06e3301ee887fd9a7b06bedff37 (diff)
downloadgdb-61034b0b6acc6ff72def5f5ecdbe628edc5d67ea.zip
gdb-61034b0b6acc6ff72def5f5ecdbe628edc5d67ea.tar.gz
gdb-61034b0b6acc6ff72def5f5ecdbe628edc5d67ea.tar.bz2
NDS32/BFD: Correct an aliasing error in `nds32_elf_check_relocs'
Fix an aliasing build error: cc1: warnings being treated as errors .../bfd/elf32-nds32.c: In function 'nds32_elf_check_relocs': .../bfd/elf32-nds32.c:6644: warning: dereferencing type-punned pointer will break strict-aliasing rules make[3]: *** [elf32-nds32.lo] Error 1 in a way following commit 6edfbbad0864 ("Fix up gcc4.1 aliasing warnings"), <https://sourceware.org/ml/binutils/2005-10/msg00071.html>. bfd/ * elf32-nds32.c (nds32_elf_check_relocs): Avoid aliasing warning from GCC.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-nds32.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4dc5256..1e34b19 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2016-10-18 Maciej W. Rozycki <macro@imgtec.com>
+ * elf32-nds32.c (nds32_elf_check_relocs): Avoid aliasing warning
+ from GCC.
+
+2016-10-18 Maciej W. Rozycki <macro@imgtec.com>
+
* elf32-arm.c (elf32_arm_update_relocs): Rename `index' local
variable to `reloc_index'.
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 81195a4..fdeada7 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -6629,6 +6629,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
else
{
asection *s;
+ void *vpp;
Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx);
@@ -6640,8 +6641,8 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (s == NULL)
return FALSE;
- head = ((struct elf_nds32_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct elf_nds32_dyn_relocs **) vpp;
}
p = *head;