This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Why does slurp_ia64_unwind_table complain unwind symbol type?
- From: David Mosberger <davidm at napali dot hpl dot hp dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: davidm at hpl dot hp dot com, binutils at sources dot redhat dot com
- Date: Fri, 22 Oct 2004 01:53:15 -0700
- Subject: Re: Why does slurp_ia64_unwind_table complain unwind symbol type?
- References: <20041021161704.GA24203@lucon.org>
- Reply-to: davidm at hpl dot hp dot com
It's been a while, but IIRC, the case you're seeing just wasn't
considered/tested/supported, because it didn't happen with GCC/gas,
hence the warning.
The symbol-table reading code assumes that if the unwind-table entries
are not absolute, they're relative to a section-start. This appears
not to be true for icc v8.1 compiled programs. For example:
$ objdump --section .IA_64.unwind --reloc os-linux.o
src/os-linux.o: file format elf64-ia64-little
RELOCATION RECORDS FOR [.IA_64.unwind]:
OFFSET TYPE VALUE
0000000000000000 SEGREL64LSB _Uia64_get_elf_image
0000000000000008 SEGREL64LSB _Uia64_get_elf_image+0x0000000000000360
0000000000000010 SEGREL64LSB __udt__Uia64_get_elf_image
0000000000000018 SEGREL64LSB maps_next
0000000000000020 SEGREL64LSB maps_next+0x0000000000001900
0000000000000028 SEGREL64LSB __udt_maps_next
0000000000000030 SEGREL64LSB maps_init
0000000000000038 SEGREL64LSB maps_init+0x0000000000000370
0000000000000040 SEGREL64LSB __udt_maps_init
whereas the same GCC-compiled binary shows:
$ objdump --section .IA_64.unwind --reloc src/os-linux.o
src/os-linux.o: file format elf64-ia64-little
RELOCATION RECORDS FOR [.IA_64.unwind]:
OFFSET TYPE VALUE
0000000000000000 SEGREL64LSB .text
0000000000000008 SEGREL64LSB .text+0x0000000000000560
0000000000000010 SEGREL64LSB .IA_64.unwind_info
0000000000000018 SEGREL64LSB .text+0x0000000000000560
0000000000000020 SEGREL64LSB .text+0x00000000000014d0
0000000000000028 SEGREL64LSB .IA_64.unwind_info+0x0000000000000028
IIRC, gas takes care of making values section-relative whenever
possible, so perhaps this is really a difference of gas vs. ias.
To support the icc/ias object files, I think we'd have to translate
the non-section symbols to a section/offset pair. I _think_ that's as
easy as just adding the symbol's value. The patch below seems to do
the trick for me. If nobody sees any problem with it, please check it
in.
Thanks,
--david
binutils/ChangeLog
2004-10-22 David Mosberger <davidm@hpl.hp.com>
* readelf.c (slurp_ia64_unwind_table): Support relocations against
non-section symbols by adding in the symbol value.
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.257
diff -u -r1.257 readelf.c
--- binutils/readelf.c 12 Oct 2004 14:17:02 -0000 1.257
+++ binutils/readelf.c 22 Oct 2004 08:51:41 -0000
@@ -4409,25 +4409,11 @@
{
relname = elf_ia64_reloc_type (ELF32_R_TYPE (rp->r_info));
sym = aux->symtab + ELF32_R_SYM (rp->r_info);
-
- if (ELF32_ST_TYPE (sym->st_info) != STT_SECTION)
- {
- warn (_("Skipping unexpected symbol type %u\n"),
- ELF32_ST_TYPE (sym->st_info));
- continue;
- }
}
else
{
relname = elf_ia64_reloc_type (ELF64_R_TYPE (rp->r_info));
sym = aux->symtab + ELF64_R_SYM (rp->r_info);
-
- if (ELF64_ST_TYPE (sym->st_info) != STT_SECTION)
- {
- warn (_("Skipping unexpected symbol type %u\n"),
- ELF64_ST_TYPE (sym->st_info));
- continue;
- }
}
if (strncmp (relname, "R_IA64_SEGREL", 13) != 0)
@@ -4442,15 +4428,15 @@
{
case 0:
aux->table[i].start.section = sym->st_shndx;
- aux->table[i].start.offset += rp->r_addend;
+ aux->table[i].start.offset += rp->r_addend + sym->st_value;
break;
case 1:
aux->table[i].end.section = sym->st_shndx;
- aux->table[i].end.offset += rp->r_addend;
+ aux->table[i].end.offset += rp->r_addend + sym->st_value;
break;
case 2:
aux->table[i].info.section = sym->st_shndx;
- aux->table[i].info.offset += rp->r_addend;
+ aux->table[i].info.offset += rp->r_addend + sym->st_value;
break;
default:
break;