OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [testsuite/] [ld-tic6x/] [tic6x.exp] - Blame information for rev 139

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 117 khays
if { ! [istarget tic6x-*-*] } {
2
    return
3
}
4
 
5
foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] {
6
    if { [runtest_file_p $runtests $test] } {
7
        run_dump_test [file rootname $test]
8
    }
9
}
10
 
11
set shlibtests {
12
    {"C6X shared library without --dsbt-index"
13
     "-shared  -Tdsbt.ld --dsbt-size=3"
14
     "-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s}
15
     {{readelf -WSsrld shlib-noindex.rd}
16
      {objdump "-drj.plt -j.text" shlib-noindex.dd}
17
      {objdump -sj.got shlib-noindex.sd}}
18
      "libtestn.so"}
19
    {"C6X shared library, LE, RELA"
20
     "-shared  -Tdsbt.ld --dsbt-index=2 --dsbt-size=3"
21
     "-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s}
22
     {{readelf -WSsrld shlib-1.rd}
23
      {objdump "-drj.plt -j.text" shlib-1.dd}
24
      {objdump -sj.got shlib-1.sd}}
25
      "libtest.so"}
26
    {"C6X nonstatic app using shared library, LE, RELA"
27
     "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtest.so"
28
     "-mdsbt -mpic -mpid=near" {shlib-app-1.s}
29
     {{readelf -WSsrld shlib-app-1.rd}
30
      {objdump "-drj.plt -j.text" shlib-app-1.dd}
31
      {objdump -sj.got shlib-app-1.sd}
32
      {objdump -R shlib-app-1.od}}
33
     "shlib-dynapp-1"}
34
    {"C6X shared library, LE, REL"
35
     "-shared  -Tdsbt.ld --dsbt-index=2 --dsbt-size=3"
36
     "-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-1.s shlib-2.s}
37
     {{readelf -WSsrld shlib-1r.rd}
38
      {objdump "-drj.plt -j.text" shlib-1r.dd}
39
      {objdump -sj.got shlib-1r.sd}}
40
      "libtestr.so"}
41
    {"C6X nonstatic app using shared library, LE, REL"
42
     "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestr.so"
43
     "-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-app-1r.s}
44
     {{readelf -WSsrld shlib-app-1r.rd}
45
      {objdump "-drj.plt -j.text" shlib-app-1r.dd}
46
      {objdump -sj.got shlib-app-1r.sd}
47
      {objdump -R shlib-app-1r.od}}
48
     "shlib-dynapp-1r"}
49
    {"C6X shared library, BE, RELA"
50
     "-shared  -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3"
51
     "-mdsbt -mpic -mpid=near -mbig-endian" {shlib-1.s shlib-2.s}
52
     {{readelf -WSsrld shlib-1b.rd}
53
      {objdump "-drj.plt -j.text" shlib-1b.dd}
54
      {objdump -sj.got shlib-1b.sd}}
55
      "libtestb.so"}
56
    {"C6X nonstatic app using shared library, BE, RELA"
57
     "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestb.so"
58
     "-mdsbt -mpic -mpid=near -mbig-endian" {shlib-app-1.s}
59
     {{readelf -WSsrld shlib-app-1b.rd}
60
      {objdump "-drj.plt -j.text" shlib-app-1b.dd}
61
      {objdump -sj.got shlib-app-1b.sd}
62
      {objdump -R shlib-app-1b.od}}
63
     "shlib-dynapp-1b"}
64
    {"C6X shared library, BE, REL"
65
     "-shared  -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3"
66
     "-mdsbt -mpic -mpid=near -mgenerate-rel -mbig-endian" {shlib-1.s shlib-2.s}
67
     {{readelf -WSsrld shlib-1rb.rd}
68
      {objdump "-drj.plt -j.text" shlib-1rb.dd}
69
      {objdump -sj.got shlib-1rb.sd}}
70
      "libtestrb.so"}
71
    {"C6X nonstatic app using shared library, BE, REL"
72
     "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestrb.so"
73
     "-mdsbt -mpic -mpid=near -mgenerate-rel -mbig-endian" {shlib-app-1r.s}
74
     {{readelf -WSsrld shlib-app-1rb.rd}
75
      {objdump "-drj.plt -j.text" shlib-app-1rb.dd}
76
      {objdump -sj.got shlib-app-1rb.sd}
77
      {objdump -R shlib-app-1rb.od}}
78
     "shlib-dynapp-1rb"}
79
 
80
    {"C6X static app, LE, RELA"
81
     "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3"
82
     "-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s shlib-app-1.s}
83
     {{readelf -WSsrld static-app-1.rd}
84
      {objdump "-drj.plt -j.text" static-app-1.dd}
85
      {objdump -sj.got static-app-1.sd}
86
      {objdump -R static-app-1.od}}
87
     "static-app-1"}
88
    {"C6X static app, LE, REL"
89
     "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3"
90
     "-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-1.s shlib-2.s shlib-app-1r.s}
91
     {{readelf -WSsrld static-app-1r.rd}
92
      {objdump "-drj.plt -j.text" static-app-1r.dd}
93
      {objdump -sj.got static-app-1r.sd}
94
      {objdump -R static-app-1r.od}}
95
     "static-app-1r"}
96
    {"C6X static app, BE, RELA"
97
     "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3"
98
     "-mdsbt -mpic -mpid=near -mbig-endian" {shlib-1.s shlib-2.s shlib-app-1.s}
99
     {{readelf -WSsrld static-app-1b.rd}
100
      {objdump "-drj.plt -j.text" static-app-1b.dd}
101
      {objdump -sj.got static-app-1b.sd}
102
      {objdump -R static-app-1b.od}}
103
     "static-app-1b"}
104
    {"C6X static app, BE, REL"
105
     "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3"
106
     "-mdsbt -mpic -mpid=near -mbig-endian -mgenerate-rel" {shlib-1.s shlib-2.s shlib-app-1r.s}
107
     {{readelf -WSsrld static-app-1rb.rd}
108
      {objdump "-drj.plt -j.text" static-app-1rb.dd}
109
      {objdump -sj.got static-app-1rb.sd}
110
      {objdump -R static-app-1rb.od}}
111
     "static-app-1rb"}
112
}
113
 
114
run_ld_link_tests $shlibtests
115
 
116
if { [istarget tic6x-*-elf] } {
117
    set expected_osabi "Bare-metal C6000"
118
} elseif { [istarget tic6x-*-uclinux] } {
119
    set expected_osabi "Linux C6000"
120
} else {
121
    return
122
}
123
 
124
if { ![ld_assemble_flags $as "-mpic -mpid=near" $srcdir/$subdir/shlib-1.s tmpdir/shlib-1.o]
125
     || ![ld_assemble_flags $as "-mpic -mpid=near" $srcdir/$subdir/shlib-2.s tmpdir/shlib-2.o]
126
     || ![ld_assemble $as $srcdir/$subdir/shlib-app-1.s tmpdir/shlib-app-1.o]
127
     || ![ld_assemble_flags $as "-mpic -mpid=near -mbig-endian" $srcdir/$subdir/shlib-1.s tmpdir/shlib-1b.o]
128
     || ![ld_assemble_flags $as "-mpic -mpid=near -mbig-endian" $srcdir/$subdir/shlib-2.s tmpdir/shlib-2b.o]
129
     || ![ld_assemble_flags $as -mbig-endian $srcdir/$subdir/shlib-app-1.s tmpdir/shlib-app-1b.o]
130
     || ![ld_simple_link $ld tmpdir/libtest.so "-shared tmpdir/shlib-1.o tmpdir/shlib-2.o"]
131
     || ![ld_simple_link $ld tmpdir/libtestb.so "-shared -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"]
132
     || ![ld_simple_link $ld tmpdir/shlib.o "-r tmpdir/shlib-1.o tmpdir/shlib-2.o"]
133
     || ![ld_simple_link $ld tmpdir/shlibb.o "-r -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"]
134
     || ![ld_simple_link $ld tmpdir/dynapp-1 "tmpdir/libtest.so tmpdir/shlib-app-1.o"]
135
     || ![ld_simple_link $ld tmpdir/dynapp-1b "-EB tmpdir/libtestb.so tmpdir/shlib-app-1b.o"] } {
136
    unresolved "TIC6X OSABI tests"
137
    return
138
}
139
 
140
# A procedure to check the OS/ABI field in the ELF header of a binary file.
141
proc check_osabi_tic6x { test_name binary_file } {
142
    global READELF
143
    global READELFFLAGS
144
    global expected_osabi
145
 
146
    set cmd "$READELF $READELFFLAGS --file-header $binary_file"
147
    send_log "$cmd\n"
148
    set got [remote_exec host [concat sh -c [list "$cmd >dump.out"]] "" "/dev/null"]
149
 
150
    if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
151
        send_log "$got\n"
152
        unresolved "$test_name"
153
        remote_file build delete "dump.out"
154
        return
155
    }
156
    remote_upload host "dump.out"
157
 
158
    if { ![regexp "\n\[ \]*OS/ABI:\[ \]*(.+)\n\[ \]*ABI" \
159
           [file_contents dump.out] nil osabi] } {
160
        verbose "proc check_osabi_tic6x: Readelf failed to extract an ELF header from $binary_file"
161
        unresolved "$test_name"
162
    } elseif { $osabi == $expected_osabi } {
163
        pass "$test_name"
164
    } else {
165
        verbose "Expected OSABI: $expected_osabi, Obtained osabi: $osabi"
166
        fail "$test_name"
167
    }
168
    remote_file build delete "dump.out"
169
    remote_file host delete "dump.out"
170
}
171
 
172
check_osabi_tic6x "C6X shared library OSABI, LE" tmpdir/libtest.so
173
check_osabi_tic6x "C6X shared library OSABI, BE" tmpdir/libtestb.so
174
check_osabi_tic6x "C6X dynamic app OSABI, LE" tmpdir/dynapp-1
175
check_osabi_tic6x "C6X dynamic app OSABI, BE" tmpdir/dynapp-1b
176
 
177
set expected_osabi "UNIX - System V"
178
 
179
check_osabi_tic6x "C6X relocatable link OSABI, LE" tmpdir/shlib.o
180
check_osabi_tic6x "C6X relocatable link OSABI, BE" tmpdir/shlibb.o

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.