PATCH: ld/2218: Weak undefined symbol doesn't work properly with PIE
H. J. Lu
hjl@lucon.org
Tue Feb 21 14:30:00 GMT 2006
On Tue, Feb 21, 2006 at 10:49:19AM +1030, Alan Modra wrote:
>
> Please check in pie.exp that -pie is supported by compiling and linking
> a simple "int(main){return 0;}". Not all compilers support -pie, and
> not all systems have Scrt0.o installed.
>
I will check it in shortly. Tested with icc on Linux.
H.J.
----
2006-02-20 H.J. Lu <hongjiu.lu@intel.com>
* ld-pie/pie.c: New file.
* ld-pie/pie.exp: Check if compiler supports -pie.
--- ld/testsuite/ld-pie/pie.c.check 2006-02-20 18:41:43.000000000 -0800
+++ ld/testsuite/ld-pie/pie.c 2006-02-20 18:41:35.000000000 -0800
@@ -0,0 +1,5 @@
+int
+main ()
+{
+ return 0;
+}
--- ld/testsuite/ld-pie/pie.exp.check 2006-02-20 11:58:19.000000000 -0800
+++ ld/testsuite/ld-pie/pie.exp 2006-02-20 18:48:23.000000000 -0800
@@ -24,6 +24,14 @@ if { ![istarget *-*-linux*] } {
return
}
+# Check if -pie is supported or not.
+send_log "$CC -pie $srcdir/$subdir/pie.c -o tmpdir/pie"
+catch "exec $CC -pie $srcdir/$subdir/pie.c -o tmpdir/pie" exec_output
+send_log "$exec_output\n"
+if { ![string match "" $exec_output] } {
+ return
+}
+
set array_tests {
{"weak undefined" "-pie" "" {weakundef.c} "weakundef" "weakundef.out" "-fPIC"}
{"weak undefined data" "-pie" "" {weakundef-data.c} "weakundef-data" "weakundef.out" "-fPIC"}
More information about the Binutils
mailing list