summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-gc
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2011-10-19 07:17:11 +0000
committerAlan Modra <amodra@bigpond.net.au>2011-10-19 07:17:11 +0000
commitb69dfb6b6253d681dce5ab3161f4ded9cfcc7f02 (patch)
tree3f83a7d31124d39e0bf1fd9404199925e6c7319e /ld/testsuite/ld-gc
parenta906610fd02991b5cbcfd4842b4913ccde6e34f3 (diff)
downloadbinutils-redhat-b69dfb6b6253d681dce5ab3161f4ded9cfcc7f02.tar.gz
PR ld/13177
bfd/ * elflink.c (_bfd_elf_gc_mark_rsec): Set symbol "mark". (elf_gc_sweep_symbol): Don't test plt/got refcounts, instead test "mark". Hide undefweak too. Clear def_regular and ref_regular. * elf-m10300.c (mn10300_elf_relocate_section): Ignore unresolved reloc errors from garbage-collected code. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-bfin.c (bfin_relocate_section): Likewise. (bfinfdpic_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. ld/testsuite/ * 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.
Diffstat (limited to 'ld/testsuite/ld-gc')
-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
4 files changed, 63 insertions, 0 deletions
diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp
index b7d6dffd90..57f0ec3f7c 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 0000000000..b19ce2b34c
--- /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 0000000000..89fe8b48fe
--- /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 0000000000..6fac355f89
--- /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