This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Fix ld-shared tests for gcc 4.3


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.
2008-02-14  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-shared/sh1.c (shlib_overriddencall2): Moved to ...
	* ld-shared/sh2.c (shlib_overriddencall2): Here.  New.

--- ld/testsuite/ld-shared/sh1.c.pic	1999-06-08 20:04:03.000000000 -0700
+++ ld/testsuite/ld-shared/sh1.c	2008-02-14 11:15:20.000000000 -0800
@@ -71,12 +71,6 @@ shlib_shlibcall2 ()
 {
   return shlib_overriddencall2 ();
 }
-
-int
-shlib_overriddencall2 ()
-{
-  return 7;
-}
 #endif
 
 /* This function calls a function defined by the main program.  */
--- ld/testsuite/ld-shared/sh2.c.pic	1999-05-03 00:29:09.000000000 -0700
+++ ld/testsuite/ld-shared/sh2.c	2008-02-14 11:15:38.000000000 -0800
@@ -12,3 +12,11 @@ shlib_shlibcalled ()
 {
   return 5;
 }
+
+#ifndef XCOFF_TEST
+int
+shlib_overriddencall2 ()
+{
+  return 7;
+}
+#endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]