Update year range in copyright notice of binutils files
[deliverable/binutils-gdb.git] / ld / testsuite / ld-msp430-elf / msp430-elf.exp
CommitLineData
7ef3addb 1# Expect script for various MSP430 ELF tests.
b3adc24a 2# Copyright (C) 2002-2020 Free Software Foundation, Inc.
7ef3addb
JL
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
22if { ![istarget "msp430*elf*"] } {
23 return
24}
25
e25de718
JL
26# List contains test-items with 3 items followed by 2 lists, one item and
27# one optional item:
28# 0:name
29# 1:ld/ar leading options, placed before object files
30# 2:ld/ar trailing options, placed after object files
31# 3:assembler options
32# 4:filenames of assembler files
33# 5:list of actions, options and expected outputs.
34# 6:name of output file
35# 7:compiler flags (optional)
36#
37# Actions: { command command-line-options file-containg-expected-output-regexps }
38# Commands:
39# objdump: Apply objdump options on result.
40# nm: Apply nm options on result.
41# readelf: Apply readelf options on result.
42# ld: Don't apply anything on result. Compare output during linking with
43# the file containing regexps (which is the second arg, not the third).
44# Note that this *must* be the first action if it is to be used at all;
45# in all other cases, any output from the linker during linking is
46# treated as a sign of an error and FAILs the test.
47#
48#
c0ea7c52 49
7ef3addb
JL
50set msp430regionprefixtests {
51 {"Move main() to .upper.text" "-T msp430.ld --code-region=upper"
52 "" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"}
53 {"Move main() to .upper.text. No .lower.text in ld script" "-T msp430-no-lower.ld --code-region=upper"
54 "" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"}
55 {"Move main() to .lower.text" "-T msp430.ld --code-region=lower"
56 "" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-lower"}
57 {"Move \"either\" main() to .lower.text" "-T msp430.ld --code-region=either"
58 "" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-either"}
59
60 {"Move glob_var to .upper.data" "-T msp430.ld --data-region=upper"
61 "" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
62 {"Move glob_var to .upper.data. No .lower.data in ld script" "-T msp430-no-lower.ld --data-region=upper"
63 "" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
64 {"Move glob_var to .lower.data" "-T msp430.ld --data-region=lower"
65 "" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
66 {"Move \"either\" glob_var to .lower.data" "-T msp430.ld --data-region=lower"
67 "" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
68
69 {"Move glob_zero to .upper.bss" "-T msp430.ld --data-region=upper"
70 "" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
71 {"Move glob_zero to .upper.bss. No .lower.bss in ld script." "-T msp430-no-lower.ld --data-region=upper"
72 "" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
73 {"Move glob_zero to .lower.bss" "-T msp430.ld --data-region=lower"
74 "" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
75 {"Move \"either\" glob_zero to .lower.bss" "-T msp430.ld --data-region=lower"
76 "" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
77
78 {"Move glob_const to .upper.rodata" "-T msp430.ld --data-region=upper"
79 "" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
80 {"Move glob_const to .upper.rodata. No .lower.rodata in ld script." "-T msp430-no-lower.ld --data-region=upper"
81 "" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
82 {"Move glob_const to .lower.rodata" "-T msp430.ld --data-region=lower"
83 "" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
84 {"Move \"either\" glob_const to .lower.rodata" "-T msp430.ld --data-region=lower"
85 "" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
86}
87
88set msp430regionprefixuniquesectiontests {
89 {"Move main() to .upper.text, with -ffunction/data-sections" "-T msp430.ld --code-region=upper"
90 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"}
91 {"Move main() to .upper.text. No .lower.text in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --code-region=upper"
92 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"}
93 {"Move main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=lower"
94 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-lower"}
95 {"Move \"either\" main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=either"
96 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-either"}
97
98 {"Move glob_var to .upper.data, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
99 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
100 {"Move glob_var to .upper.data. No .lower.data in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
101 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
102 {"Move glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
103 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
104 {"Move \"either\" glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
105 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
106
107 {"Move glob_zero to .upper.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
108 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
109 {"Move glob_zero to .upper.bss. No .lower.bss in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
110 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
111 {"Move glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
112 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
113 {"Move \"either\" glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
114 "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
115
116 {"Move glob_const to .upper.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
117 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
118 {"Move glob_const to .upper.rodata. No .lower.rodata in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
119 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
120 {"Move glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
121 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
122 {"Move \"either\" glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
123 "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
124}
125
126set msp430eithershuffletests {
127 {"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text"
128 "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s}
129 {{objdump -d main-text-upper.d}} "either-to-upper-text"}
130 {"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data"
131 "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s}
132 {{objdump -D main-var-upper.d}} "either-to-upper-data"}
133 {"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss"
134 "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s}
135 {{objdump -D main-bss-upper.d}} "either-to-upper-bss"}
136 {"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata"
137 "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s}
138 {{objdump -D main-const-upper.d}} "either-to-upper-const"}
139
140 {"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text, with -ffunction/data-sections"
141 "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s}
142 {{objdump -d main-text-upper.d}} "either-to-upper-text-unique-sec"}
143 {"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data, with -ffunction/data-sections"
144 "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s}
145 {{objdump -D main-var-upper.d}} "either-to-upper-data-unique-sec"}
146 {"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss, with -ffunction/data-sections"
147 "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s}
148 {{objdump -D main-bss-upper.d}} "either-to-upper-bss-unique-sec"}
149 {"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata, with -ffunction/data-sections"
150 "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s}
151 {{objdump -D main-const-upper.d}} "either-to-upper-const-unique-sec"}
152}
153
e25de718
JL
154set msp430warntests {
155 {"Warn when section cannot be transformed because output section does not exist in linker script (text,data,bss,rodata)"
156 "-T msp430-no-lower.ld --code-region=lower --data-region=lower" "" "" {warn-no-lower.s}
157 {{ld warn-no-lower.r}} "warn-no-lower"}
158 {"Warn when section cannot be transformed because output section does not exist in linker script (text only)"
159 "-T msp430-no-lower.ld --code-region=lower" "" "" {warn-no-lower.s}
160 {{ld warn-no-lower-code.r}} "warn-no-lower-code"}
161 {"Warn when section cannot be transformed because output section does not exist in linker script (data,bss,rodata)"
162 "-T msp430-no-lower.ld --data-region=lower" "" "" {warn-no-lower.s}
163 {{ld warn-no-lower-data.r}} "warn-no-lower-data"}
164}
165
c0ea7c52 166# Don't run further tests when msp430 ISA is selected
e25de718
JL
167if {[string match "*-mcpu=msp430 *" [board_info [target_info name] multilib_flags]]
168 || [string match "*-mcpu=msp430" [board_info [target_info name] multilib_flags]]} {
169 return
170}
7ef3addb
JL
171run_ld_link_tests $msp430regionprefixtests
172run_ld_link_tests $msp430regionprefixuniquesectiontests
173run_ld_link_tests $msp430eithershuffletests
e25de718
JL
174run_ld_link_tests $msp430warntests
175
176run_dump_test valid-map
c0ea7c52
JL
177
178# Don't run data region tests if a data region is specified
179if {[string match "*-mdata-region*" [board_info [target_info name] multilib_flags]]} {
180 return
181}
182# GNU object attribute dump tests
183run_dump_test attr-gnu-region-lower
184run_dump_test attr-gnu-region-upper
185run_dump_test attr-gnu-region-lower-upper
This page took 0.138103 seconds and 4 git commands to generate.