diff options
author | DJ Delorie <dj@delorie.com> | 2005-08-31 23:45:46 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2005-08-31 23:45:46 +0000 |
commit | 221ada70f44338be4b546944b42b4ec6d631b792 (patch) | |
tree | 7c7ca279cbf9cde307f9e1fe7545055e91870bce /bfd/elf64-x86-64.c | |
parent | b4359e360f51c1507b4621e6260a4b0a7ea8b5ae (diff) | |
download | gdb-221ada70f44338be4b546944b42b4ec6d631b792.tar.gz |
* elf32-i386.c (elf_i386_check_relocs): Don't cast a unary &
address operator, as that breaks GCC's strict aliasing rules.
(elf_i386_size_dynamic_sections): Avoid the need for type
punning.
* elf64-x86-64.c (elf_x86_64_check_relocs): Don't cast a unary
& address operator, as that breaks GCC's strict aliasing
rules.
(elf_x86_64_size_dynamic_sections): Avoid the need for type
punning.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 4c7a49e3a75..0520906b227 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -946,6 +946,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, } else { + void **vpp; /* Track dynamic relocs needed for local syms too. We really need local syms available to do this easily. Oh well. */ @@ -956,8 +957,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (s == NULL) return FALSE; - head = ((struct elf64_x86_64_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + /* Beware of type punned pointers vs strict aliasing + rules. */ + vpp = &(elf_section_data (s)->local_dynrel); + head = (struct elf64_x86_64_dyn_relocs **)vpp; } p = *head; @@ -1586,8 +1589,8 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { struct elf64_x86_64_dyn_relocs *p; - for (p = *((struct elf64_x86_64_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + for (p = (struct elf64_x86_64_dyn_relocs *) + (elf_section_data (s)->local_dynrel); p != NULL; p = p->next) { |