This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
mips plts & vxworks
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: binutils <binutils at sources dot redhat dot com>
- Date: Mon, 07 Apr 2008 13:56:03 +0100
- Subject: mips plts & vxworks
This patch fixes a bug with vxworks PLT generation. Vxworks' dynamic loader
expects undefined symbols to have zero value, not the PLT slot address. (I.e.
expects MIPS to be like other architectures in this regard.)
ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
2008-04-07 Nathan Sidwell <nathan@codesourcery.com>
bfd/
* elfxx-mips.c (_bfd_mips_vxworks_adjust_dynamic_symbol): Don't
set the value of undefined symbols in shared objects.
ld/testsuite/
* ld-vxworks/plt-mips1.s: New.
* ld-vxworks/plt-mips1.d: New.
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.229
diff -c -3 -p -r1.229 elfxx-mips.c
*** bfd/elfxx-mips.c 31 Mar 2008 14:02:26 -0000 1.229
--- bfd/elfxx-mips.c 7 Apr 2008 12:04:56 -0000
*************** _bfd_mips_vxworks_adjust_dynamic_symbol
*** 7466,7480 ****
htab->splt->size += htab->plt_entry_size;
/* If the output file has no definition of the symbol, set the
! symbol's value to the address of the stub. For executables,
! point at the PLT load stub rather than the lazy resolution stub;
! this stub will become the canonical function address. */
! if (!h->def_regular)
{
h->root.u.def.section = htab->splt;
h->root.u.def.value = h->plt.offset;
! if (!info->shared)
! h->root.u.def.value += 8;
}
/* Make room for the .got.plt entry and the R_JUMP_SLOT relocation. */
--- 7466,7479 ----
htab->splt->size += htab->plt_entry_size;
/* If the output file has no definition of the symbol, set the
! symbol's value to the address of the stub. Point at the PLT
! load stub rather than the lazy resolution stub; this stub
! will become the canonical function address. */
! if (!info->shared && !h->def_regular)
{
h->root.u.def.section = htab->splt;
h->root.u.def.value = h->plt.offset;
! h->root.u.def.value += 8;
}
/* Make room for the .got.plt entry and the R_JUMP_SLOT relocation. */
Index: ld/testsuite/ld-vxworks/plt-mips1.d
===================================================================
RCS file: ld/testsuite/ld-vxworks/plt-mips1.d
diff -N ld/testsuite/ld-vxworks/plt-mips1.d
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-vxworks/plt-mips1.d 7 Apr 2008 12:11:14 -0000
***************
*** 0 ****
--- 1,10 ----
+ # target: mips*-*-*
+ # source: plt-mips1.s
+ # ld: -shared -z now
+ # readelf: -s
+
+ #...
+ [0-9]*: 00000000 0 FUNC GLOBAL DEFAULT UND Foo
+ #...
+ [0-9]*: 00000000 0 FUNC GLOBAL DEFAULT UND Foo
+ #...
Index: ld/testsuite/ld-vxworks/plt-mips1.s
===================================================================
RCS file: ld/testsuite/ld-vxworks/plt-mips1.s
diff -N ld/testsuite/ld-vxworks/plt-mips1.s
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-vxworks/plt-mips1.s 7 Apr 2008 12:11:14 -0000
***************
*** 0 ****
--- 1 ----
+ lw $25,%call16(Foo)($28)