Commit | Line | Data |
---|---|---|
bfff1642 | 1 | # Expect script for ld-mn10300 tests |
2571583a | 2 | # Copyright (C) 2007-2017 Free Software Foundation, Inc. |
bfff1642 NC |
3 | # |
4 | # This file is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
863f7a5f NC |
16 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
17 | # MA 02110-1301, USA. | |
bfff1642 NC |
18 | # |
19 | ||
20 | if {!([istarget "am3*-*-*"]) && !([istarget "mn10300*-*-*"]) } { | |
21 | return | |
22 | } | |
23 | ||
24 | # Set up a list as described in ld-lib.exp | |
25 | ||
569006e5 | 26 | set mn10300_tests { |
bfff1642 NC |
27 | { |
28 | "am33 string merging" | |
897aea50 | 29 | "-relax -Ttext 0x8000074" "" |
bfff1642 NC |
30 | "" |
31 | { "i36434.s" "i36434-2.s" } | |
32 | { {objdump -dz i36434.d} } | |
33 | "i36434.x" | |
34 | } | |
35 | { | |
569006e5 | 36 | "difference of two same-section symbols" |
897aea50 | 37 | "-Ttext 0" "" |
bfff1642 NC |
38 | "" |
39 | { "i112045-1.s" } | |
40 | { {objdump -d i112045-1.d} } | |
41 | "i112045-1.x" | |
42 | } | |
43 | { | |
569006e5 | 44 | "difference of two same-section symbols where the difference is held in another section" |
897aea50 | 45 | "-relax -Ttext 100" "" |
bfff1642 | 46 | "" |
569006e5 NC |
47 | { "i112045-3.s" } |
48 | { {objdump -D i112045-3.d} } | |
49 | "i112045-3.x" | |
bfff1642 | 50 | } |
b5f5fd96 NC |
51 | { |
52 | "relaxation and alignment directives" | |
897aea50 | 53 | "-relax -Ttext 100 -Tbss 300" "" |
b5f5fd96 NC |
54 | "" |
55 | { "i127740.s" } | |
56 | { {objdump -d i127740.d} } | |
57 | "i127740.x" | |
58 | } | |
bfff1642 NC |
59 | { |
60 | "adjustment of symbols due to relaxation" | |
897aea50 | 61 | "-Tdata 1f -Ttext 0 -relax" "" |
569006e5 NC |
62 | "" |
63 | { "i135409-1.s" } | |
64 | { {readelf --syms i135409-1.d} } | |
65 | "i135409-1.x" | |
66 | } | |
67 | { | |
68 | "adjustment of symbols due to relaxation (with alignment directives)" | |
897aea50 | 69 | "-Tdata 1f -Ttext 0 -relax" "" |
569006e5 NC |
70 | "" |
71 | { "i135409-2.s" } | |
72 | { {readelf --syms i135409-2.d} } | |
73 | "i135409-2.x" | |
74 | } | |
b5f5fd96 NC |
75 | { |
76 | "adjustment of symbols due to relaxation (with a symbol in the deleted region)" | |
897aea50 | 77 | "-Tdata 1f -Ttext 0 -relax" "" |
b5f5fd96 NC |
78 | "" |
79 | { "i135409-3.s" } | |
80 | { {objdump -d i135409-3.d} } | |
81 | "i135409-3.x" | |
82 | } | |
fc91707c | 83 | { |
e23f1610 | 84 | "adjusting a 16-bit forward branch" |
897aea50 | 85 | "-Ti135409-4.t -relax" "" |
fc91707c NC |
86 | "" |
87 | { "i135409-4.s" } | |
88 | { {objdump -d i135409-4.d} } | |
89 | "i135409-4.x" | |
90 | } | |
e23f1610 NC |
91 | { |
92 | "adjusting a 16-bit backward branch" | |
897aea50 | 93 | "-Ti135409-5.t -relax" "" |
e23f1610 NC |
94 | "" |
95 | { "i135409-5.s" } | |
96 | { {objdump -d i135409-5.d} } | |
97 | "i135409-5.x" | |
98 | } | |
e9e9cead NC |
99 | { |
100 | "relaxing offsets into a merged string section" | |
897aea50 | 101 | "-Ti143317.t -shared -relax" "" |
e9e9cead NC |
102 | "" |
103 | { "i143317.s" } | |
104 | { {objdump -d i143317.d} } | |
105 | "i143317.x" | |
106 | } | |
569006e5 NC |
107 | } |
108 | ||
109 | run_ld_link_tests $mn10300_tests | |
110 | ||
111 | if {!([istarget "am3*-*-*"])} { | |
112 | return | |
113 | } | |
114 | ||
115 | set am33_tests { | |
116 | { | |
117 | "difference of two same-section symbols (in a shared library)" | |
897aea50 | 118 | "-shared" "" |
bfff1642 | 119 | "" |
569006e5 NC |
120 | { "i112045-2.s" } |
121 | { {objdump -R i112045-2.d} } | |
122 | "i112045-2.x" | |
bfff1642 NC |
123 | } |
124 | } | |
125 | ||
126 | run_ld_link_tests $am33_tests | |
127 | ||
128 | proc i126256-test { } { | |
129 | global CC | |
130 | global ld | |
131 | global srcdir | |
132 | global subdir | |
133 | ||
134 | set tmpdir tmpdir | |
569006e5 NC |
135 | set testname "Seg fault whilst linking one shared library into another when relaxation is enabled." |
136 | ||
137 | if {![is_remote host] && [which $CC] == 0} then { | |
138 | return | |
139 | } | |
bfff1642 NC |
140 | |
141 | if { ![ld_compile "$CC -mrelax -fPIC" $srcdir/$subdir/i126256-1.c $tmpdir/i126256-1.o] } { | |
142 | unresolved $testname | |
143 | return | |
144 | } | |
145 | ||
146 | if { ![ld_compile "$CC -mrelax -fPIC" $srcdir/$subdir/i126256-2.c $tmpdir/i126256-2.o] } { | |
147 | unresolved $testname | |
148 | return | |
149 | } | |
150 | ||
d9816402 | 151 | if { ![ld_link $ld $tmpdir/i126256-1.so "-shared $tmpdir/i126256-1.o -e 0"]} { |
bfff1642 NC |
152 | unresolved $testname |
153 | return | |
154 | } | |
155 | ||
d9816402 | 156 | if { ![ld_link $ld $tmpdir/i126256-2.so "--relax -shared $tmpdir/i126256-2.o $tmpdir/i126256-1.so -e 0"]} { |
bfff1642 NC |
157 | fail $testname |
158 | return | |
159 | } | |
160 | ||
161 | pass $testname | |
162 | } | |
163 | ||
164 | i126256-test |