public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Tweak for i386 vxworks support
@ 2005-05-18 15:23 Daniel Jacobowitz
  2005-05-19  8:46 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-05-18 15:23 UTC (permalink / raw)
  To: binutils

The VxWorks dynamic loader pretty much only honors R_*_COPY and
R_*_JUMP_SLOT relocations in executables - the normal range of relocations
are processed in shared libraries.  This works except for some cases
involving weak symbols (which VxWorks doesn't use), and when ld decides to
eliminate a copy relocation.  So disable that for VxWorks.  I'm trying to
persuade them to process relocations more normally, but no luck so far.

Is this patch OK?

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-05-17  Daniel Jacobowitz  <dan@codesourcery.com>

	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't eliminate
	copy relocations for VxWorks.

Index: elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.140
diff -u -p -r1.140 elf32-i386.c
--- elf32-i386.c	17 May 2005 16:43:02 -0000	1.140
+++ elf32-i386.c	17 May 2005 20:24:52 -0000
@@ -1431,7 +1431,13 @@ elf_i386_adjust_dynamic_symbol (struct b
       return TRUE;
     }
 
-  if (ELIMINATE_COPY_RELOCS)
+  htab = elf_i386_hash_table (info);
+
+  /* If there aren't any dynamic relocs in read-only sections, then
+     we can keep the dynamic relocs and avoid the copy reloc.  This
+     doesn't work on VxWorks, where we can not have dynamic relocations
+     (other than copy and jump slot relocations) in an executable.  */
+  if (ELIMINATE_COPY_RELOCS && !htab->is_vxworks)
     {
       struct elf_i386_link_hash_entry * eh;
       struct elf_i386_dyn_relocs *p;
@@ -1444,8 +1450,6 @@ elf_i386_adjust_dynamic_symbol (struct b
 	    break;
 	}
 
-      /* If we didn't find any dynamic relocs in read-only sections, then
-	 we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
       if (p == NULL)
 	{
 	  h->non_got_ref = 0;
@@ -1463,8 +1467,6 @@ elf_i386_adjust_dynamic_symbol (struct b
      both the dynamic object and the regular object will refer to the
      same memory location for the variable.  */
 
-  htab = elf_i386_hash_table (info);
-
   /* We must generate a R_386_COPY reloc to tell the dynamic linker to
      copy the initial value out of the dynamic object and into the
      runtime process image.  */

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

* Re: Tweak for i386 vxworks support
  2005-05-18 15:23 Tweak for i386 vxworks support Daniel Jacobowitz
@ 2005-05-19  8:46 ` Alan Modra
  2005-05-19  8:55   ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2005-05-19  8:46 UTC (permalink / raw)
  To: binutils

On Wed, May 18, 2005 at 11:21:33AM -0400, Daniel Jacobowitz wrote:
> The VxWorks dynamic loader pretty much only honors R_*_COPY and
> R_*_JUMP_SLOT relocations in executables - the normal range of relocations
> are processed in shared libraries.  This works except for some cases
> involving weak symbols (which VxWorks doesn't use), and when ld decides to
> eliminate a copy relocation.  So disable that for VxWorks.  I'm trying to
> persuade them to process relocations more normally, but no luck so far.
> 
> Is this patch OK?

No, I think you'll need to look at other places that invoke
ELIMINATE_COPY_RELOCS.  I suggest 

#define ELIMINATE_COPY_RELOCS(HTAB) (!(HTAB)->is_vxworks)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: Tweak for i386 vxworks support
  2005-05-19  8:46 ` Alan Modra
@ 2005-05-19  8:55   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2005-05-19  8:55 UTC (permalink / raw)
  To: binutils

On Thu, May 19, 2005 at 06:02:49PM +0930, Alan Modra wrote:
> On Wed, May 18, 2005 at 11:21:33AM -0400, Daniel Jacobowitz wrote:
> > The VxWorks dynamic loader pretty much only honors R_*_COPY and
> > R_*_JUMP_SLOT relocations in executables - the normal range of relocations
> > are processed in shared libraries.  This works except for some cases
> > involving weak symbols (which VxWorks doesn't use), and when ld decides to
> > eliminate a copy relocation.  So disable that for VxWorks.  I'm trying to
> > persuade them to process relocations more normally, but no luck so far.
> > 
> > Is this patch OK?
> 
> No, I think you'll need to look at other places that invoke
> ELIMINATE_COPY_RELOCS.  I suggest 
> 
> #define ELIMINATE_COPY_RELOCS(HTAB) (!(HTAB)->is_vxworks)

Uh, no, I'm not thinking straight.  Patch is OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

end of thread, other threads:[~2005-05-19  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-18 15:23 Tweak for i386 vxworks support Daniel Jacobowitz
2005-05-19  8:46 ` Alan Modra
2005-05-19  8:55   ` Alan Modra

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