public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Don't set has_static_relocs for R_MIPS_JALR
@ 2009-08-22 19:34 Adam Nemet
  2009-08-27 19:07 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Nemet @ 2009-08-22 19:34 UTC (permalink / raw)
  To: binutils

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:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Don't set has_static_relocs for R_MIPS_JALR
  2009-08-22 19:34 [PATCH] Don't set has_static_relocs for R_MIPS_JALR Adam Nemet
@ 2009-08-27 19:07 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2009-08-27 19:07 UTC (permalink / raw)
  To: Adam Nemet; +Cc: binutils

Adam Nemet <anemet@caviumnetworks.com> writes:
> 	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Don't set
> 	has_static_relocs for R_MIPS_JALR.

OK, thanks.

Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-27 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-22 19:34 [PATCH] Don't set has_static_relocs for R_MIPS_JALR Adam Nemet
2009-08-27 19:07 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).