This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: update dwarf2 asm unwind info [hppa64-*-* failures]
- From: Richard Henderson <rth at twiddle dot net>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: sje at cup dot hp dot com, gcc-patches at gcc dot gnu dot org, dave dot anglin at nrc-cnrc dot gc dot ca, binutils-patches at sources dot redhat dot com
- Date: Wed, 13 Aug 2008 08:28:38 -0700
- Subject: Re: update dwarf2 asm unwind info [hppa64-*-* failures]
- References: <20080813150605.8929C4E6A@hiauly1.hia.nrc.ca> <48A2F980.2030405@twiddle.net>
Richard Henderson wrote:
John David Anglin wrote:
readelf: Warning: unable to apply unsupported reloc type 9 to section
.eh_frame
R_PARISC_PCREL32 is reloc 9. Before the change, the reloc was
R_PARISC_NONE.
The change in reloc type is good. The warning can be fixed by adding
the appropriate support to readelf's relocation interpretation
functions, like is_32bit_pcrel_reloc.
Like so.
r~
Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.423
diff -u -r1.423 readelf.c
--- readelf.c 8 Aug 2008 19:24:48 -0000 1.423
+++ readelf.c 13 Aug 2008 15:25:04 -0000
@@ -8156,7 +8156,7 @@
case EM_ARM:
return reloc_type == 3; /* R_ARM_REL32 */
case EM_PARISC:
- return reloc_type == 0; /* R_PARISC_NONE. *//* FIXME: This reloc is generated, but it may be a bug. */
+ return reloc_type == 9; /* R_PARISC_PCREL32. */
case EM_PPC:
return reloc_type == 26; /* R_PPC_REL32. */
case EM_PPC64:
@@ -8219,6 +8219,36 @@
}
}
+/* Like is_32bit_pcrel_reloc except that it returns TRUE iff RELOC_TYPE is
+ a 64-bit pc-relative RELA relocation used in DWARF debug sections. */
+
+static bfd_boolean
+is_64bit_pcrel_reloc (unsigned int reloc_type)
+{
+ switch (elf_header.e_machine)
+ {
+ case EM_ALPHA:
+ return reloc_type == 11; /* R_ALPHA_SREL64 */
+ case EM_IA_64:
+ return reloc_type == 0x4f; /* R_IA64_PCREL64LSB */
+ case EM_PARISC:
+ return reloc_type == 72; /* R_PARISC_PCREL64 */
+ case EM_PPC64:
+ return reloc_type == 44; /* R_PPC64_REL64 */
+ case EM_SPARC32PLUS:
+ case EM_SPARCV9:
+ case EM_SPARC:
+ return reloc_type == 46; /* R_SPARC_DISP64 */
+ case EM_X86_64:
+ return reloc_type == 24; /* R_X86_64_PC64 */
+ case EM_S390_OLD:
+ case EM_S390:
+ return reloc_type == 23; /* R_S390_PC64 */
+ default:
+ return FALSE;
+ }
+}
+
/* Like is_32bit_abs_reloc except that it returns TRUE iff RELOC_TYPE is
a 16-bit absolute RELA relocation used in DWARF debug sections. */
@@ -8392,7 +8422,8 @@
if (is_32bit_abs_reloc (reloc_type)
|| is_32bit_pcrel_reloc (reloc_type))
reloc_size = 4;
- else if (is_64bit_abs_reloc (reloc_type))
+ else if (is_64bit_abs_reloc (reloc_type)
+ || is_64bit_pcrel_reloc (reloc_type))
reloc_size = 8;
else if (is_16bit_abs_reloc (reloc_type))
reloc_size = 2;
@@ -8436,7 +8467,8 @@
addend = is_rela ? rp->r_addend : byte_get (loc, reloc_size);
- if (is_32bit_pcrel_reloc (reloc_type))
+ if (is_32bit_pcrel_reloc (reloc_type)
+ || is_64bit_pcrel_reloc (reloc_type))
byte_put (loc, (addend + sym->st_value) - rp->r_offset,
reloc_size);
else