This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
fix elf32-score.c warning
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Wed, 27 Sep 2006 13:38:00 +0930
- Subject: fix elf32-score.c warning
Fixes build breakage, and uses the right function to find an ELF
local sym name.
* elf32-score.c (_bfd_score_elf_relocate_section): Move assignment
to "name" so that compiler realizes it is never uninitialized.
Use bfd_elf_sym_name.
Index: bfd/elf32-score.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-score.c,v
retrieving revision 1.1
diff -u -p -r1.1 elf32-score.c
--- bfd/elf32-score.c 16 Sep 2006 23:51:50 -0000 1.1
+++ bfd/elf32-score.c 27 Sep 2006 04:05:42 -0000
@@ -2308,9 +2308,13 @@ _bfd_score_elf_relocate_section (bfd *ou
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma + sec->output_offset + sym->st_value);
+ relocation = (sec->output_section->vma
+ + sec->output_offset
+ + sym->st_value);
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
- if ((sec->flags & SEC_MERGE) && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ if ((sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
asection *msec;
bfd_vma addend, value;
@@ -2432,13 +2436,6 @@ _bfd_score_elf_relocate_section (bfd *ou
}
}
- if (h == NULL)
- {
- name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name));
- if (name == NULL || *name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
-
r = score_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section, contents, rel, relocs,
relocation, info, sec, name,
--
Alan Modra
IBM OzLabs - Linux Technology Centre