aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2013-08-24 22:37:18 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2013-08-24 22:37:18 +0000
commitfe9cd7ab17990a589ed8e14c4a6157d218ae9ae5 (patch)
tree968e9fc63d7924dace758dfe1af914aca29a4078 /ld
parentaea6ea421db3f7327c4943cbe13abceb42b84be6 (diff)
downloadgdb-fe9cd7ab17990a589ed8e14c4a6157d218ae9ae5.zip
gdb-fe9cd7ab17990a589ed8e14c4a6157d218ae9ae5.tar.gz
gdb-fe9cd7ab17990a589ed8e14c4a6157d218ae9ae5.tar.bz2
* ld-elf/comm-data.exp: Use check_shared_lib_support rather than
explicit patterns for test target qualification. Define extra tool flags for *-*-hpux* and tic6x-*-* targets. Link with a linker script. Use alternative patterns for targets that do not eliminate copy relocs, currently mn10300-*-* and vax-*-*. * ld-elf/comm-data2.s: Handle HPUX's `.comm' syntax. * ld-elf/comm-data2.ld: New test linker script. * ld-elf/comm-data2.xd: Match section's VMA too. Ignore ASCII data dump. * ld-elf/comm-data2r.rd: New test pattern. * ld-elf/comm-data2r.sd: New test pattern. * ld-elf/comm-data2r.xd: New test pattern. * ld-mips-elf/comm-data.exp: Use check_shared_lib_support rather than an explicit pattern for test target qualification. Link with a linker script.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog18
-rw-r--r--ld/testsuite/ld-elf/comm-data.exp49
-rw-r--r--ld/testsuite/ld-elf/comm-data2.ld20
-rw-r--r--ld/testsuite/ld-elf/comm-data2.s4
-rw-r--r--ld/testsuite/ld-elf/comm-data2.xd2
-rw-r--r--ld/testsuite/ld-elf/comm-data2r.rd3
-rw-r--r--ld/testsuite/ld-elf/comm-data2r.sd10
-rw-r--r--ld/testsuite/ld-elf/comm-data2r.xd2
-rw-r--r--ld/testsuite/ld-mips-elf/comm-data.exp9
9 files changed, 96 insertions, 21 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index f6858ed..765d4be 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,23 @@
2013-08-24 Maciej W. Rozycki <macro@linux-mips.org>
+ * ld-elf/comm-data.exp: Use check_shared_lib_support rather than
+ explicit patterns for test target qualification. Define extra
+ tool flags for *-*-hpux* and tic6x-*-* targets. Link with a
+ linker script. Use alternative patterns for targets that do not
+ eliminate copy relocs, currently mn10300-*-* and vax-*-*.
+ * ld-elf/comm-data2.s: Handle HPUX's `.comm' syntax.
+ * ld-elf/comm-data2.ld: New test linker script.
+ * ld-elf/comm-data2.xd: Match section's VMA too. Ignore ASCII
+ data dump.
+ * ld-elf/comm-data2r.rd: New test pattern.
+ * ld-elf/comm-data2r.sd: New test pattern.
+ * ld-elf/comm-data2r.xd: New test pattern.
+ * ld-mips-elf/comm-data.exp: Use check_shared_lib_support rather
+ than an explicit pattern for test target qualification. Link
+ with a linker script.
+
+2013-08-24 Maciej W. Rozycki <macro@linux-mips.org>
+
* ld-arm/export-class.exp: Handle non-EABI targets.
2013-08-23 Roland McGrath <mcgrathr@google.com>
diff --git a/ld/testsuite/ld-elf/comm-data.exp b/ld/testsuite/ld-elf/comm-data.exp
index e180693..71613c5 100644
--- a/ld/testsuite/ld-elf/comm-data.exp
+++ b/ld/testsuite/ld-elf/comm-data.exp
@@ -24,17 +24,22 @@
# Written by Maciej W. Rozycki <macro@codesourcery.com>
#
-# Exclude non-ELF targets.
-if ![is_elf_format] {
+# This test is for ELF shared-library targets.
+if { ![is_elf_format] || ![check_shared_lib_support] } {
return
}
-# Exclude some more targets; feel free to include your favorite one
-# if you like.
-if { ![istarget *-*-linux*]
- && ![istarget *-*-nacl*]
- && ![istarget *-*-gnu*] } {
- return
+# This target requires extra GAS options when building code for shared
+# libraries.
+set AFLAGS_PIC ""
+if [istarget "tic6x-*-*"] {
+ append AFLAGS_PIC " -mpic -mpid=near"
+}
+# This target requires a non-default emulation for successful shared
+# library/executable builds.
+set LFLAGS ""
+if [istarget "tic6x-*-*"] {
+ append LFLAGS " -melf32_tic6x_le"
}
set testname "Common symbol override test"
@@ -43,8 +48,8 @@ set testname "Common symbol override test"
run_ld_link_tests [list \
[list \
"$testname (auxiliary shared object build)" \
- "-shared" "" \
- "" \
+ "$LFLAGS -shared" "" \
+ "$AFLAGS_PIC" \
{ comm-data1.s } \
{ \
{ readelf -s comm-data1.sd } \
@@ -58,23 +63,35 @@ set AFLAGS ""
if [is_elf64 "tmpdir/libcomm-data.so"] {
append AFLAGS " --defsym ELF64=1"
}
+# HPUX targets use a different .comm syntax.
+if [istarget "*-*-hpux*"] {
+ append AFLAGS " --defsym HPUX=1"
+}
setup_xfail "arm*-*-*" "ld/13802"
+# List targets here that keep copy relocs rather than eliminating
+# them where possible in favour to dynamic relocs in the relevant
+# loadable sections; see also the "-z nocopyreloc" command-line
+# option and the ELIMINATE_COPY_RELOCS macro some backends use.
+set copy_reloc [expr [istarget mn10300-*-*] || [istarget vax-*-*]]
+
# Verify that a common symbol has been converted to an undefined
# reference to the global symbol of the same name defined above
# and that the debug reference has been dropped.
run_ld_link_tests [list \
[list \
"$testname" \
- "-Ltmpdir -lcomm-data" "" \
+ "$LFLAGS -T comm-data2.ld -Ltmpdir -lcomm-data" "" \
"$AFLAGS" \
{ comm-data2.s } \
- { \
- { readelf -s comm-data2.sd } \
- { readelf -r comm-data2.rd } \
- { readelf "-x .debug_foo" comm-data2.xd } \
- } \
+ [list \
+ [list readelf -s \
+ [expr { $copy_reloc ? "comm-data2r.sd" : "comm-data2.sd"}]] \
+ [list readelf -r \
+ [expr { $copy_reloc ? "comm-data2r.rd" : "comm-data2.rd"}]] \
+ [list readelf "-x .debug_foo" \
+ [expr { $copy_reloc ? "comm-data2r.xd" : "comm-data2.xd"}]]] \
"comm-data" \
] \
[list \
diff --git a/ld/testsuite/ld-elf/comm-data2.ld b/ld/testsuite/ld-elf/comm-data2.ld
new file mode 100644
index 0000000..3244453
--- /dev/null
+++ b/ld/testsuite/ld-elf/comm-data2.ld
@@ -0,0 +1,20 @@
+SECTIONS
+{
+ . = 0x12340000;
+ .bss : { *(.dynbss) }
+ .got : { *(.got.plt) *(.got) }
+ .dynamic : { *(.dynamic) }
+ .data : { *(.data) }
+ . = 0x56780000;
+ .rela.dyn : { *(.rela.*) }
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ . = 0x76540000;
+ .debug_foo : { *(.debug_foo) }
+ .shstrtab : { *(.shstrtab) }
+ .symtab : { *(.symtab) }
+ .strtab : { *(.strtab) }
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-elf/comm-data2.s b/ld/testsuite/ld-elf/comm-data2.s
index 87f981e..168671f 100644
--- a/ld/testsuite/ld-elf/comm-data2.s
+++ b/ld/testsuite/ld-elf/comm-data2.s
@@ -3,7 +3,11 @@
.globl __start
_start:
__start:
+ .ifdef HPUX
+foo .comm 4
+ .else
.comm foo, 4, 4
+ .endif
.section .debug_foo,"",%progbits
.balign 16
.ifdef ELF64
diff --git a/ld/testsuite/ld-elf/comm-data2.xd b/ld/testsuite/ld-elf/comm-data2.xd
index 37a6d90..bff116e 100644
--- a/ld/testsuite/ld-elf/comm-data2.xd
+++ b/ld/testsuite/ld-elf/comm-data2.xd
@@ -1,2 +1,2 @@
Hex dump of section '\.debug_foo':
- +0x0+ +00000000 00000000 00000000 00000000 +\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.
+ +0x0*76540000 00000000 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-elf/comm-data2r.rd b/ld/testsuite/ld-elf/comm-data2r.rd
new file mode 100644
index 0000000..52c486d
--- /dev/null
+++ b/ld/testsuite/ld-elf/comm-data2r.rd
@@ -0,0 +1,3 @@
+Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ +Offset +Info +Type +Sym\.Value +Sym\. Name \+ Addend
+0*12340000 +[0-9a-f]+ +R_.*_COPY +0*12340000 +foo \+ 0
diff --git a/ld/testsuite/ld-elf/comm-data2r.sd b/ld/testsuite/ld-elf/comm-data2r.sd
new file mode 100644
index 0000000..685b0be
--- /dev/null
+++ b/ld/testsuite/ld-elf/comm-data2r.sd
@@ -0,0 +1,10 @@
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+#...
+ +[0-9]+: +0*12340000 +4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +foo
+#...
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+#...
+ +[0-9]+: +0*12340000 +4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +foo
+#pass
diff --git a/ld/testsuite/ld-elf/comm-data2r.xd b/ld/testsuite/ld-elf/comm-data2r.xd
new file mode 100644
index 0000000..58f6f2a
--- /dev/null
+++ b/ld/testsuite/ld-elf/comm-data2r.xd
@@ -0,0 +1,2 @@
+Hex dump of section '\.debug_foo':
+ +0x0*76540000 (?:12340000 00000000|00003412 00000000|00000000 00003412) 00000000 00000000 .*
diff --git a/ld/testsuite/ld-mips-elf/comm-data.exp b/ld/testsuite/ld-mips-elf/comm-data.exp
index 28ca290..2b6fa83 100644
--- a/ld/testsuite/ld-mips-elf/comm-data.exp
+++ b/ld/testsuite/ld-mips-elf/comm-data.exp
@@ -24,9 +24,10 @@
# Written by Maciej W. Rozycki <macro@codesourcery.com>
#
-# Exclude non-Linux targets; feel free to include your favorite one
-# if you like.
-if ![istarget mips*-*-linux*] {
+# This test is for MIPS shared-library targets.
+if { ![istarget mips*-*-*]
+ || ![is_elf_format]
+ || ![check_shared_lib_support] } {
return
}
@@ -64,7 +65,7 @@ proc mips_comm_data_test { abi flag emul reloc } {
run_ld_link_tests [list \
[list \
"$testname" \
- "$LDFLAGS $ZFLAG -Ltmpdir -lmips-$abi-$reloc-comm-data" "" \
+ "$LDFLAGS $ZFLAG -T ../ld-elf/comm-data2.ld -Ltmpdir -lmips-$abi-$reloc-comm-data" "" \
"$AFLAGS -call_nonpic" \
{ ../ld-elf/comm-data2.s } \
{ \