aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-elf/elf.exp35
-rw-r--r--ld/testsuite/ld-gc/gc.exp14
-rw-r--r--ld/testsuite/ld-gc/libpersonality.s11
-rw-r--r--ld/testsuite/ld-gc/personality.d10
-rw-r--r--ld/testsuite/ld-gc/personality.s28
-rw-r--r--ld/testsuite/lib/ld-lib.exp48
7 files changed, 121 insertions, 35 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7912508..26ea036 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2011-10-19 Alan Modra <amodra@gmail.com>
+
+ * ld-elf/elf.exp: Move test for shared lib support..
+ * lib/ld-lib.exp (check_shared_lib_support): ..to here. Add m68hc1*,
+ and s/ms1/mt/.
+ (check_gc_sections_available): Match hppa*64 not hppa64. Comment.
+ * ld-gc/libpersonality.s: New.
+ * ld-gc/personality.s, * ld-gc/personality.d: New.
+ * ld-gc/gc.exp: Run personality test.
+
2011-10-18 David S. Miller <davem@davemloft.net>
* ld-sparc/tlssunbin32.dd: Update for TLS call relaxation fix
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index b993c96..42b5541 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -58,40 +58,7 @@ if { ![istarget hppa64*-hpux*] } {
# should not seg-fault whilst creating the binary.
#
# Only run the test on targets thats support creating shared libraries.
-if { ! [istarget arc-*-*]
- && ! [istarget avr-*-*]
- && ! [istarget cr16-*-*]
- && ! [istarget cris*-*-*]
- && ! [istarget crx-*-*]
- && ! [istarget d10v-*-*]
- && ! [istarget d30v-*-*]
- && ! [istarget dlx-*-*]
- && ! [istarget fr30-*-*]
- && ! [istarget frv-*-*]
- && ! [istarget h8300-*-*]
- && ! [istarget i860-*-*]
- && ! [istarget i960-*-*]
- && ! [istarget ip2k-*-*]
- && ! [istarget iq2000-*-*]
- && ! [istarget lm32-*-*]
- && ! [istarget m32c-*-*]
- && ! [istarget m32r-*-*]
- && ! [istarget mcore*-*-*]
- && ! [istarget mep-*-*]
- && ! [istarget microblaze-*-*]
- && ! [istarget mn10200-*-*]
- && ! [istarget moxie-*-*]
- && ! [istarget ms1-*-*]
- && ! [istarget msp430-*-*]
- && ! [istarget openrisc-*-*]
- && ! [istarget or32-*-*]
- && ! [istarget pj-*-*]
- && ! [istarget rx-*-*]
- && ! [istarget spu-*-*]
- && ! [istarget v850*-*-*]
- && ! [istarget xstormy16-*-*]
- && ! [istarget *-*-irix*]
- && ! [istarget *-*-rtems] } {
+if { [check_shared_lib_support] } then {
run_ld_link_tests {
{"Build shared library for next test"
"-shared" "" "note-3.s" {} "note-3.so" }
diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp
index b7d6dff..57f0ec3 100644
--- a/ld/testsuite/ld-gc/gc.exp
+++ b/ld/testsuite/ld-gc/gc.exp
@@ -97,6 +97,20 @@ test_gc "Check --gc-section/-r/-u" "gcrel" $ld "-r --gc-sections -u used_func"
run_dump_test "noent"
run_dump_test "abi-note"
run_dump_test "start"
+
+if { [is_elf_format] && [check_shared_lib_support] } then {
+ set gasopt ""
+ if { [istarget tic6x-*] } then {
+ set gasopt "-mpic -mpid=near"
+ }
+ if {![ld_assemble_flags $as $gasopt $srcdir/$subdir/libpersonality.s tmpdir/libpersonality.o]
+ || ![ld_simple_link $ld tmpdir/libpersonality.so "-shared tmpdir/libpersonality.o"] } then {
+ fail libpersonality
+ } else {
+ run_dump_test "personality"
+ }
+}
+
if { [is_remote host] || [which $CC] != 0 } {
if { [istarget "*-*-linux*"]
|| [istarget "*-*-gnu*"] } {
diff --git a/ld/testsuite/ld-gc/libpersonality.s b/ld/testsuite/ld-gc/libpersonality.s
new file mode 100644
index 0000000..b19ce2b
--- /dev/null
+++ b/ld/testsuite/ld-gc/libpersonality.s
@@ -0,0 +1,11 @@
+ .weak __gxx_personality_v0
+ .type __gxx_personality_v0,%function
+__gxx_personality_v0:
+ .long 0
+ .size __gxx_personality_v0, . - __gxx_personality_v0
+
+ .globl __gxx_personality_v1
+ .type __gxx_personality_v1,%function
+__gxx_personality_v1:
+ .long 0
+ .size __gxx_personality_v1, . - __gxx_personality_v1
diff --git a/ld/testsuite/ld-gc/personality.d b/ld/testsuite/ld-gc/personality.d
new file mode 100644
index 0000000..89fe8b4
--- /dev/null
+++ b/ld/testsuite/ld-gc/personality.d
@@ -0,0 +1,10 @@
+#name: --gc-sections with __gxx_personality
+#ld: --gc-sections -e main -L tmpdir -lpersonality
+#nm: -n
+#xfail: bfin-*-* cris*-*-* frv-*-* mn10300-*-* vax-*-* xtensa-*-*
+# above targets don't support cfi
+
+#failif
+#...
+.*gxx_personality.*
+#...
diff --git a/ld/testsuite/ld-gc/personality.s b/ld/testsuite/ld-gc/personality.s
new file mode 100644
index 0000000..6fac355
--- /dev/null
+++ b/ld/testsuite/ld-gc/personality.s
@@ -0,0 +1,28 @@
+ .section .text.loseme,"ax",%progbits
+ .globl loseme
+ .type loseme,%function
+loseme:
+ .cfi_startproc
+ .cfi_personality 0,__gxx_personality_v0
+ .long 0
+ .cfi_endproc
+ .size loseme, . - loseme
+
+ .section .text.loseme2,"ax",%progbits
+ .globl loseme2
+ .type loseme2,%function
+loseme2:
+ .cfi_startproc
+ .cfi_personality 0,__gxx_personality_v1
+ .long 0
+ .cfi_endproc
+ .size loseme2, . - loseme2
+
+ .section .text.main,"ax",%progbits
+ .globl main
+ .type main, %function
+main:
+ .cfi_startproc
+ .long 0
+ .cfi_endproc
+ .size main, . - main
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 3e77a5a..e764591 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1418,7 +1418,7 @@ proc check_gc_sections_available { } {
|| [istarget or32-*-*]
|| [istarget pj*-*-*]
|| [istarget alpha-*-*]
- || [istarget hppa64-*-*]
+ || [istarget hppa*64-*-*]
|| [istarget i370-*-*]
|| [istarget i860-*-*]
|| [istarget ia64-*-*]
@@ -1439,6 +1439,8 @@ proc check_gc_sections_available { } {
}
# Check if the ld used by gcc supports --gc-sections.
+ # FIXME: this test is useless since ld --help always says
+ # --gc-sections is available
set ld_output [remote_exec host $ld "--help"]
if { [ string first "--gc-sections" $ld_output ] >= 0 } {
set gc_sections_available_saved 1
@@ -1449,6 +1451,50 @@ proc check_gc_sections_available { } {
return $gc_sections_available_saved
}
+# Returns true if -shared is supported on the target
+# Only used and accurate for ELF targets at the moment
+
+proc check_shared_lib_support { } {
+ if {![istarget arc-*-*]
+ && ![istarget avr-*-*]
+ && ![istarget cr16-*-*]
+ && ![istarget cris*-*-*]
+ && ![istarget crx-*-*]
+ && ![istarget d10v-*-*]
+ && ![istarget d30v-*-*]
+ && ![istarget dlx-*-*]
+ && ![istarget fr30-*-*]
+ && ![istarget frv-*-*]
+ && ![istarget h8300-*-*]
+ && ![istarget i860-*-*]
+ && ![istarget i960-*-*]
+ && ![istarget ip2k-*-*]
+ && ![istarget iq2000-*-*]
+ && ![istarget lm32-*-*]
+ && ![istarget m32c-*-*]
+ && ![istarget m32r-*-*]
+ && ![istarget m68hc1*-*-*]
+ && ![istarget mcore*-*-*]
+ && ![istarget mep-*-*]
+ && ![istarget microblaze-*-*]
+ && ![istarget mn10200-*-*]
+ && ![istarget moxie-*-*]
+ && ![istarget msp430-*-*]
+ && ![istarget mt-*-*]
+ && ![istarget openrisc-*-*]
+ && ![istarget or32-*-*]
+ && ![istarget pj-*-*]
+ && ![istarget rx-*-*]
+ && ![istarget spu-*-*]
+ && ![istarget v850*-*-*]
+ && ![istarget xstormy16-*-*]
+ && ![istarget *-*-irix*]
+ && ![istarget *-*-rtems] } {
+ return 1
+ }
+ return 0
+}
+
# Returns true if the target ld supports the plugin API.
proc check_plugin_api_available { } {
global plugin_api_available_saved