From 5f181e2111c86a95bb43a09853f0c5a68a70749c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 20 Mar 2009 17:39:04 +0000 Subject: [PATCH] ld/ 2009-03-20 H.J. Lu PR ld/9970 * ldlang.c (lang_end): Warn missing entry symbol for -pie. ld/testsuite/ 2009-03-20 H.J. Lu PR ld/9970 * ld-pie/pie.exp: Use -fpie to compile. Run *.d tests. * ld-pie/start.d: New. * ld-pie/start.s: Likewise. --- ld/ChangeLog | 5 +++++ ld/ldlang.c | 2 +- ld/testsuite/ChangeLog | 8 ++++++++ ld/testsuite/ld-pie/pie.exp | 11 +++++++++-- ld/testsuite/ld-pie/start.d | 8 ++++++++ ld/testsuite/ld-pie/start.s | 4 ++++ 6 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 ld/testsuite/ld-pie/start.d create mode 100644 ld/testsuite/ld-pie/start.s diff --git a/ld/ChangeLog b/ld/ChangeLog index a0bc21c25b..2eefd162fb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2009-03-20 H.J. Lu + + PR ld/9970 + * ldlang.c (lang_end): Warn missing entry symbol for -pie. + 2009-03-19 Alan Modra * emultempl/spuelf.em (spu_before_allocation): Report errors from diff --git a/ld/ldlang.c b/ld/ldlang.c index 9f62e9f02c..55d1043a70 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -5417,7 +5417,7 @@ lang_end (void) bfd_boolean warn; if ((link_info.relocatable && !link_info.gc_sections) - || link_info.shared) + || (link_info.shared && !link_info.executable)) warn = entry_from_cmdline; else warn = TRUE; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f50755fc3b..5a806ffac5 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2009-03-20 H.J. Lu + + PR ld/9970 + * ld-pie/pie.exp: Use -fpie to compile. Run *.d tests. + + * ld-pie/start.d: New. + * ld-pie/start.s: Likewise. + 2009-03-18 H.J. Lu PR ld/6766 diff --git a/ld/testsuite/ld-pie/pie.exp b/ld/testsuite/ld-pie/pie.exp index 064d9cd732..1f4effcbe7 100644 --- a/ld/testsuite/ld-pie/pie.exp +++ b/ld/testsuite/ld-pie/pie.exp @@ -28,8 +28,8 @@ if { ![istarget *-*-linux*] } { } # 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 "$CC -fpie -pie $srcdir/$subdir/pie.c -o tmpdir/pie" +catch "exec $CC -fpie -pie $srcdir/$subdir/pie.c -o tmpdir/pie" exec_output send_log "$exec_output\n" if { ![string match "" $exec_output] } { return @@ -41,3 +41,10 @@ set array_tests { } run_ld_link_exec_tests [] $array_tests + +set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +foreach t $test_list { + # We need to strip the ".d", but can leave the dirname. + verbose [file rootname $t] + run_dump_test [file rootname $t] +} diff --git a/ld/testsuite/ld-pie/start.d b/ld/testsuite/ld-pie/start.d new file mode 100644 index 0000000000..1ee22e08a4 --- /dev/null +++ b/ld/testsuite/ld-pie/start.d @@ -0,0 +1,8 @@ +#name: missing entry symbol +#ld: -pie +#warning: .*: warning: cannot find entry symbol .* +#nm: -n + +#... +[0-9a-f]+ T +foo +#... diff --git a/ld/testsuite/ld-pie/start.s b/ld/testsuite/ld-pie/start.s new file mode 100644 index 0000000000..4a70181776 --- /dev/null +++ b/ld/testsuite/ld-pie/start.s @@ -0,0 +1,4 @@ + .text + .globl foo +foo: + .byte 0 -- 2.11.0