1 # Expect script
for DWARF relocation test.
2 # Copyright
(C
) 2008-2016 Free Software Foundation
, Inc.
4 # This file is part of the GNU Binutils.
6 # This
program is free software
; you can redistribute it and
/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation
; either version
3 of the License
, or
9 #
(at your option
) any later version.
11 # This
program is distributed in the hope that it will be useful
,
12 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License
for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this
program; if not
, write to the Free Software
18 # Foundation
, Inc.
, 51 Franklin Street
- Fifth Floor
, Boston
,
23 # Written by Jan Kratochvil
(jan.kratochvil@redhat.com
)
25 # Test PR
ld/3290 Comment
8+9. DW_FORM_ref_addr used in dwarfreloc2.s was left
26 # unrelocated as its target symbol from dwarfreloc1.s became LOCAL due to its
29 # <1><57>: Abbrev Number: 2 (DW_TAG_variable)
30 # <58> DW_AT_name : i2
32 # <5d> DW_AT_type : <0x32>
34 # <5d> DW_AT_type : <0x0>
36 # Only the testcase .s files are arch-dependent, the relocations are cross-arch.
37 if { !([istarget "x86_64-*-elf*"]
38 || [istarget "x86_64-*-nacl*"]
39 || [istarget "x86_64-*-linux*"]) } {
44 {"Build dwarfreloc1xa.o"
45 "-r" "" "--elf-stt-common=no"
46 {dwarfreloc1.s} {} "dwarfreloc1xa.o"}
47 {"Build dwarfreloc1xb.o"
48 "-r" "" "--elf-stt-common=yes"
49 {dwarfreloc1.s} {} "dwarfreloc1xb.o"}
50 {"Build dwarfreloc2a.o"
51 "-r" "" "--elf-stt-common=no"
52 {dwarfreloc2.s} {} "dwarfreloc2xa.o"}
53 {"Build dwarfreloc2b.o"
54 "-r" "" "--elf-stt-common=yes"
55 {dwarfreloc2.s} {} "dwarfreloc2xb.o"}
58 run_ld_link_tests $build_tests_ld
60 set testname "Link dwarfreloc1xa.o and dwarfreloc2xa.o to dwarfreloca.o"
61 if [ld_simple_link $ld "tmpdir/dwarfreloca.o" "-r tmpdir/dwarfreloc1xa.o tmpdir/dwarfreloc2xa.o"] {
67 set testname "Link dwarfreloc1xb.o and dwarfreloc2xb.o to dwarfrelocb.o"
68 if [ld_simple_link $ld "tmpdir/dwarfrelocb.o" "-r tmpdir/dwarfreloc1xb.o tmpdir/dwarfreloc2xb.o"] {
74 # The code is copied from `ld-lib.exp'. We cannot use the functions there as
75 # they expect source
(.s or .c
) files
while we to check a `
ld -r
' output (.o).
77 set testname "Check dwarfreloca.o readelf"
78 set dumpfile "dwarfreloc.rd"
79 set cmd "$READELF --debug-dump=info tmpdir/dwarfreloca.o"
80 set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
82 remote_upload host "ld.stderr"
83 set comp_output [prune_warnings [file_contents "ld.stderr"]]
84 remote_file host delete "ld.stderr"
85 remote_file build delete "ld.stderr"
87 if ![string match "" $comp_output] then {
88 send_log "$comp_output\n"
91 remote_upload host "dump.out"
92 if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
93 verbose "output is [file_contents "dump.out"]" 2
98 remote_file build delete "dump.out"
99 remote_file host delete "dump.out"
102 set testname "Check dwarfrelocb.o readelf"
103 set dumpfile "dwarfreloc.rd"
104 set cmd "$READELF --debug-dump=info tmpdir/dwarfrelocb.o"
105 set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
107 remote_upload host "ld.stderr"
108 set comp_output [prune_warnings [file_contents "ld.stderr"]]
109 remote_file host delete "ld.stderr"
110 remote_file build delete "ld.stderr"
112 if ![string match "" $comp_output] then {
113 send_log "$comp_output\n"
116 remote_upload host "dump.out"
117 if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
118 verbose "output is [file_contents "dump.out"]" 2
123 remote_file build delete "dump.out"
124 remote_file host delete "dump.out"