~ubuntu-branches/ubuntu/utopic/binutils-arm64-cross/utopic

« back to all changes in this revision

Viewing changes to binutils-2.23.52.20130611/ld/testsuite/ld-x86-64/dwarfreloc.exp

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-06-20 17:38:09 UTC
  • Revision ID: package-import@ubuntu.com-20130620173809-app8lzgvymy5fg6c
Tags: 0.7
Build-depend on binutils-source (>= 2.23.52.20130620-1~).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Expect script for DWARF relocation test.
 
2
#   Copyright 2008, 2012  Free Software Foundation, Inc.
 
3
#
 
4
# This file is part of the GNU Binutils.
 
5
#
 
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.
 
10
#
 
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.
 
15
#
 
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,
 
19
# MA 02110-1301, USA.
 
20
#
 
21
 
 
22
#
 
23
# Written by Jan Kratochvil (jan.kratochvil@redhat.com)
 
24
#
 
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
 
27
# `ld -r'.
 
28
#
 
29
#  <1><57>: Abbrev Number: 2 (DW_TAG_variable)
 
30
#     <58>   DW_AT_name        : i2
 
31
#  ...
 
32
#     <5d>   DW_AT_type        : <0x32>
 
33
# vs.
 
34
#     <5d>   DW_AT_type        : <0x0>
 
35
 
 
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*"]) } {
 
40
    return
 
41
}
 
42
 
 
43
set build_tests_ld {
 
44
  {"Build dwarfreloc1x.o"
 
45
   "-r" "" ""
 
46
   {dwarfreloc1.s} {} "dwarfreloc1x.o"}
 
47
  {"Build dwarfreloc2.o"
 
48
   "-r" "" ""
 
49
   {dwarfreloc2.s} {} "dwarfreloc2x.o"}
 
50
}
 
51
 
 
52
run_ld_link_tests $build_tests_ld
 
53
 
 
54
set testname "Link dwarfreloc1x.o and dwarfreloc2x.o to dwarfreloc.o"
 
55
if [ld_simple_link $ld "tmpdir/dwarfreloc.o" "-r tmpdir/dwarfreloc1x.o tmpdir/dwarfreloc2x.o"] {
 
56
    pass $testname
 
57
} else {
 
58
    fail $testname
 
59
}
 
60
 
 
61
# The code is copied from `ld-lib.exp'.  We cannot use the functions there as
 
62
# they expect source (.s or .c) files while we to check a `ld -r' output (.o).
 
63
 
 
64
set testname "Check dwarfreloc.o readelf"
 
65
set dumpfile "dwarfreloc.rd"
 
66
set cmd "$READELF --debug-dump=info tmpdir/dwarfreloc.o"
 
67
set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
 
68
send_log "$cmd\n"
 
69
remote_upload host "ld.stderr"
 
70
set comp_output [prune_warnings [file_contents "ld.stderr"]]
 
71
remote_file host delete "ld.stderr"
 
72
remote_file build delete "ld.stderr"
 
73
 
 
74
if ![string match "" $comp_output] then {
 
75
    send_log "$comp_output\n"
 
76
    fail $testname
 
77
} else {
 
78
    remote_upload host "dump.out"
 
79
    if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
 
80
        verbose "output is [file_contents "dump.out"]" 2
 
81
        fail $testname
 
82
    } else {
 
83
        pass $testname
 
84
    }
 
85
    remote_file build delete "dump.out"
 
86
    remote_file host delete "dump.out"
 
87
}