This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
arm-elf linker mishandling R_ARM_REL32 with -shared
- From: Phil Blundell <pb at nexus dot co dot uk>
- To: binutils at sources dot redhat dot com
- Date: Thu, 15 Apr 2004 15:02:58 +0100
- Subject: arm-elf linker mishandling R_ARM_REL32 with -shared
Consider a source file:
.text
.word sym - .
.bss
sym:
.word 0
If this is assembled and then linked -shared, the resulting .so ends up
with a bogus R_ARM_RELATIVE relocation in .text. The patch below helps
a bit, though I still end up with an R_ARM_NONE entry in .rel.dyn. I
guess the relocs_copied code might need tweaking a bit to avoid this.
Dan, do you happen to know what's going on with this stuff?
p.
Index: elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.124
diff -u -p -r1.124 elf32-arm.h
--- elf32-arm.h 25 Mar 2004 12:48:32 -0000 1.124
+++ elf32-arm.h 15 Apr 2004 13:58:58 -0000
@@ -1338,6 +1409,8 @@ elf32_arm_final_link_relocate (howto, in
into the output file to be resolved at run time. */
if (info->shared
&& (input_section->flags & SEC_ALLOC)
+ && (r_type != R_ARM_REL32
+ || !SYMBOL_CALLS_LOCAL (info, h))
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)