public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* complex relocations and "ld -r"
@ 2009-03-25 21:01 DJ Delorie
  2009-03-26  0:09 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: DJ Delorie @ 2009-03-25 21:01 UTC (permalink / raw)
  To: binutils


If you do a relocatable link with complex relocations, elflink.c tries
to resolve the complex relocations so as to have an "absolute value"
for them.  Obviously, nothing is absolute in a relocatable link, but
the attempt causes an error about referencing undefined symbols.  Is
it sufficient to just skip that evaluation for relocatable links?


Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.331
diff -p -U3 -r1.331 elflink.c
--- elflink.c	13 Mar 2009 11:34:42 -0000	1.331
+++ elflink.c	25 Mar 2009 20:59:44 -0000
@@ -9329,7 +9329,8 @@ elf_link_input_bfd (struct elf_final_lin
 					       sym, *ps);
 		}
 
-	      if (s_type == STT_RELC || s_type == STT_SRELC)
+	      if ((s_type == STT_RELC || s_type == STT_SRELC)
+		  && !finfo->info->relocatable)
 		{
 		  bfd_vma val;
 		  bfd_vma dot = (rel->r_offset

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

* Re: complex relocations and "ld -r"
  2009-03-25 21:01 complex relocations and "ld -r" DJ Delorie
@ 2009-03-26  0:09 ` Alan Modra
  2009-03-31  1:43   ` DJ Delorie
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2009-03-26  0:09 UTC (permalink / raw)
  To: DJ Delorie; +Cc: binutils

On Wed, Mar 25, 2009 at 05:01:32PM -0400, DJ Delorie wrote:
> Index: elflink.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elflink.c,v
> retrieving revision 1.331
> diff -p -U3 -r1.331 elflink.c
> --- elflink.c	13 Mar 2009 11:34:42 -0000	1.331
> +++ elflink.c	25 Mar 2009 20:59:44 -0000
> @@ -9329,7 +9329,8 @@ elf_link_input_bfd (struct elf_final_lin
>  					       sym, *ps);
>  		}
>  
> -	      if (s_type == STT_RELC || s_type == STT_SRELC)
> +	      if ((s_type == STT_RELC || s_type == STT_SRELC)
> +		  && !finfo->info->relocatable)
>  		{
>  		  bfd_vma val;
>  		  bfd_vma dot = (rel->r_offset

Looks good to me.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: complex relocations and "ld -r"
  2009-03-26  0:09 ` Alan Modra
@ 2009-03-31  1:43   ` DJ Delorie
  0 siblings, 0 replies; 3+ messages in thread
From: DJ Delorie @ 2009-03-31  1:43 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils


> Looks good to me.

Committed then.  Thanks!

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

end of thread, other threads:[~2009-03-31  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-25 21:01 complex relocations and "ld -r" DJ Delorie
2009-03-26  0:09 ` Alan Modra
2009-03-31  1:43   ` DJ Delorie

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).