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]

Re: PATCH: Don't chck static non-ifunc-using executable


On Fri, Jul 10, 2009 at 12:31:13PM -0700, H.J. Lu wrote:
> Hi,
> 
> Static non-ifunc-using executable check will fail if libc.a has
> has ifunc functons. I am checking in this patch to disable it.
> The proper check is to use default_ld_simple_link without using
> any additional libraries.
> 
> 

I am checking in this patch to ee-enable static non-ifunc-using
executable check.



H.J.
---
2009-07-13  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-ifunc/ifunc.exp: Don't use -shared/-static to build object
	files.  Use ld_simple_link to build static non-ifunc-using
	executable.  Re-enable static non-ifunc-using executable check.
Index: ld-ifunc/ifunc.exp
===================================================================
--- ld-ifunc/ifunc.exp	(revision 6379)
+++ ld-ifunc/ifunc.exp	(working copy)
@@ -157,24 +157,28 @@ proc contains_ifunc_reloc { binary_file 
 set fails 0
 
 # Create the object files, libraries and executables.
-if ![ld_compile "$CC -c -shared -fPIC" "$srcdir/$subdir/prog.c" "tmpdir/shared_prog.o"] {
-    fail "Could not create a shared object file"
+if ![ld_compile "$CC -c -fPIC" "$srcdir/$subdir/prog.c" "tmpdir/shared_prog.o"] {
+    fail "Could not create a PIC object file"
     set fails [expr $fails + 1]
 }
-if ![ld_compile "$CC -c -static" "$srcdir/$subdir/prog.c" "tmpdir/static_prog.o"] {
-    fail "Could not create a static object file"
+if ![ld_compile "$CC -c" "$srcdir/$subdir/prog.c" "tmpdir/static_prog.o"] {
+    fail "Could not create a non-PIC object file"
     set fails [expr $fails + 1]
 }
-if ![ld_compile "$CC -c -shared -fPIC -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/shared_ifunc.o"] {
-    fail "Could not create an object file containing an IFUNC symbol"
+if ![ld_compile "$CC -c -fPIC -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/shared_ifunc.o"] {
+    fail "Could not create a PIC object file containing an IFUNC symbol"
     set fails [expr $fails + 1]
 }
-if ![ld_compile "$CC -c -static -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_ifunc.o"] {
-    fail "Could not create a static object file containing an IFUNC symbol"
+if ![ld_compile "$CC -c -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_ifunc.o"] {
+    fail "Could not create a non-PIC object file containing an IFUNC symbol"
     set fails [expr $fails + 1]
 }
-if ![ld_compile "$CC -c -static -DWITHOUT_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_noifunc.o"] {
-    fail "Could not create an ordinary static object file"
+if ![ld_compile "$CC -c -DWITHOUT_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_noifunc.o"] {
+    fail "Could not create an ordinary non-PIC object file"
+    set fails [expr $fails + 1]
+}
+if ![ld_assemble $as "$srcdir/ld-elf/empty.s" "tmpdir/empty.o"] {
+    fail "Could not create an empty object file"
     set fails [expr $fails + 1]
 }
 
@@ -207,7 +211,7 @@ if ![default_ld_link $ld "tmpdir/static_
     fail "Could not link a static executable"
     set fails [expr $fails + 1]
 }
-if ![default_ld_link $ld "tmpdir/static_nonifunc_prog" "-static -Ltmpdir tmpdir/static_prog.o tmpdir/static_noifunc.o"] {
+if ![ld_simple_link $ld "tmpdir/static_nonifunc_prog" "-static tmpdir/empty.o"] {
     fail "Could not link a non-ifunc using static executable"
     set fails [expr $fails + 1]
 }
@@ -241,11 +245,10 @@ if {! [check_osabi tmpdir/dynamic_prog {
     fail "Dynamic ifunc-using executable does not have an OS/ABI field of LINUX"
     set fails [expr $fails + 1]
 }
-# FIXME: This test will fail if libc.a has ifunc functons.
-#if {! [check_osabi tmpdir/static_nonifunc_prog {UNIX - System V}]} {
-#    fail "Static non-ifunc-using executable does not have an OS/ABI field of System V"
-#    set fails [expr $fails + 1]
-#}
+if {! [check_osabi tmpdir/static_nonifunc_prog {UNIX - System V}]} {
+    fail "Static non-ifunc-using executable does not have an OS/ABI field of System V"
+    set fails [expr $fails + 1]
+}
 
 # The linked ifunc using executables and the shared library containing
 # ifunc should contain an IFUNC symbol.  The non-ifunc using executable


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