PATCH: Fix ld-shared tests for gcc 4.3

H.J. Lu hjl.tools@gmail.com
Thu Feb 14 19:23:00 GMT 2008


Gcc 4.3 can optimize

extern int shlib_overriddencall2 ();

int
shlib_shlibcall2 ()
{
  return shlib_overriddencall2 ();
}
int
shlib_overriddencall2 ()
{
  return 7;
}

to

int
shlib_shlibcall2 ()
{
  return 7;
}

at -O2 without -fPIC. It causes "make check" failures on Linux/i386 in ld:

FAIL: shared (non PIC)
FAIL: shared (non PIC, load offset)
FAIL: shared (PIC main, non PIC so)

This patch moves shlib_overriddencall2 to sh2.c so that gcc won't
optimize it out.
I will check it in as an obvious fix. Tested on Linux/ia32,
Linux/Intel64 and Linux/ia64.


H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-pic-1.patch
Type: text/x-patch
Size: 793 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20080214/d9e17a70/attachment.bin>


More information about the Binutils mailing list