This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Don't set has_static_relocs for R_MIPS_JALR
- From: Adam Nemet <anemet at caviumnetworks dot com>
- To: binutils at sourceware dot org
- Date: Sat, 22 Aug 2009 11:48:31 -0700
- Subject: [PATCH] Don't set has_static_relocs for R_MIPS_JALR
I found this while bootstrapping the R_MIPS_JALR GCC patch. Without this fix,
R_MIPS_JALR can cause a "non-dynamic relocations refer to dynamic symbol"
error message while calling a shared library function from an executable.
The reason is that has_static_relocs is set for R_MIPS_JALR. The bug does not
trigger for all shared library function references because %call16 references
have an early exit in _bfd_mips_elf_adjust_dynamic_symbol. However if a
%got_disp is used the check is performed and it fails.
Regression-tested with ld on mips64octeon-linux.
OK?
Adam
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Don't set
has_static_relocs for R_MIPS_JALR.
Index: elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.257
diff -F^\([(a-zA-Z0-9_]\|#define\) -u -p -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.257 elfxx-mips.c
--- elfxx-mips.c 5 Aug 2009 21:17:51 -0000 1.257
+++ elfxx-mips.c 22 Aug 2009 17:55:10 -0000
@@ -7503,6 +7504,11 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s
}
break;
+ /* This is just a hint; it can safely be ignored. Don't set
+ has_static_relocs for the corresponding symbol. */
+ case R_MIPS_JALR:
+ break;
+
case R_MIPS_32:
case R_MIPS_REL32:
case R_MIPS_64: