* 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.
This commit is contained in:
parent
aea6ea421d
commit
fe9cd7ab17
9 changed files with 96 additions and 21 deletions
|
@ -1,3 +1,21 @@
|
|||
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.
|
||||
|
|
|
@ -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 \
|
||||
|
|
20
ld/testsuite/ld-elf/comm-data2.ld
Normal file
20
ld/testsuite/ld-elf/comm-data2.ld
Normal file
|
@ -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/ : { *(*) }
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Hex dump of section '\.debug_foo':
|
||||
+0x0+ +00000000 00000000 00000000 00000000 +\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.
|
||||
+0x0*76540000 00000000 00000000 00000000 00000000 .*
|
||||
|
|
3
ld/testsuite/ld-elf/comm-data2r.rd
Normal file
3
ld/testsuite/ld-elf/comm-data2r.rd
Normal file
|
@ -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
|
10
ld/testsuite/ld-elf/comm-data2r.sd
Normal file
10
ld/testsuite/ld-elf/comm-data2r.sd
Normal file
|
@ -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
|
2
ld/testsuite/ld-elf/comm-data2r.xd
Normal file
2
ld/testsuite/ld-elf/comm-data2r.xd
Normal file
|
@ -0,0 +1,2 @@
|
|||
Hex dump of section '\.debug_foo':
|
||||
+0x0*76540000 (?:12340000 00000000|00003412 00000000|00000000 00003412) 00000000 00000000 .*
|
|
@ -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 } \
|
||||
{ \
|
||||
|
|
Loading…
Reference in a new issue