SPU stack sizing
Alan Modra
amodra@bigpond.net.au
Tue May 8 02:27:00 GMT 2007
On Mon, May 07, 2007 at 11:04:50PM +0200, Ulrich Weigand wrote:
> /home/uweigand/fsf/gdb-head/bfd/elf32-spu.c:874: warning: dereferencing type-punned pointer will break strict-aliasing rules
Thanks, I ought to know better. This should silence the warning.
* elf32-spu.c (spu_elf_size_stubs): Use "void *" for psyms.
(mark_functions_via_relocs): Likewise.
Index: bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-spu.c
--- bfd/elf32-spu.c 7 May 2007 14:37:27 -0000 1.14
+++ bfd/elf32-spu.c 8 May 2007 01:53:45 -0000
@@ -858,7 +858,7 @@ spu_elf_size_stubs (bfd *output_bfd,
Elf_Internal_Shdr *symtab_hdr;
asection *section;
Elf_Internal_Sym *local_syms = NULL;
- Elf_Internal_Sym **psyms;
+ void *psyms;
if (ibfd->xvec != &bfd_elf32_spu_vec)
continue;
@@ -871,7 +871,7 @@ spu_elf_size_stubs (bfd *output_bfd,
/* Arrange to read and keep global syms for later stack analysis. */
psyms = &local_syms;
if (stack_analysis)
- psyms = (Elf_Internal_Sym **) &symtab_hdr->contents;
+ psyms = &symtab_hdr->contents;
/* Walk over each section attached to the input bfd. */
for (section = ibfd->sections; section != NULL; section = section->next)
@@ -1889,7 +1889,8 @@ mark_functions_via_relocs (asection *sec
{
Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
Elf_Internal_Shdr *symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
- Elf_Internal_Sym *syms, **psyms;
+ Elf_Internal_Sym *syms;
+ void *psyms;
static bfd_boolean warned;
internal_relocs = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL,
@@ -1898,8 +1899,8 @@ mark_functions_via_relocs (asection *sec
return FALSE;
symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
- psyms = (Elf_Internal_Sym **) &symtab_hdr->contents;
- syms = *psyms;
+ psyms = &symtab_hdr->contents;
+ syms = *(Elf_Internal_Sym **) psyms;
irela = internal_relocs;
irelaend = irela + sec->reloc_count;
for (; irela < irelaend; irela++)
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list