[PATCH 51/57][Arm][OBJDUMP] Add support for MVE instructions: lctp, letp, wlstp and...
[binutils-gdb.git] / ld / testsuite / ld-msp430-elf / msp430-elf.exp
blobb6f3151c80dd4907b166249f11a3f9d7cf2c5fa3
1 # Expect script for various MSP430 ELF tests.
2 #   Copyright (C) 2002-2019 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,
19 # MA 02110-1301, USA.
22 if { ![istarget "msp430*elf*"] } {
23     return
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)
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.
49 set msp430regionprefixtests {
50   {"Move main() to .upper.text" "-T msp430.ld --code-region=upper"
51     "" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"}
52   {"Move main() to .upper.text. No .lower.text in ld script" "-T msp430-no-lower.ld --code-region=upper"
53     "" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"}
54   {"Move main() to .lower.text" "-T msp430.ld --code-region=lower"
55     "" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-lower"}
56   {"Move \"either\" main() to .lower.text" "-T msp430.ld --code-region=either"
57     "" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-either"}
59   {"Move glob_var to .upper.data" "-T msp430.ld --data-region=upper"
60     "" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
61   {"Move glob_var to .upper.data. No .lower.data in ld script" "-T msp430-no-lower.ld --data-region=upper"
62     "" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
63   {"Move glob_var to .lower.data" "-T msp430.ld --data-region=lower"
64     "" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
65   {"Move \"either\" glob_var to .lower.data" "-T msp430.ld --data-region=lower"
66     "" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
68   {"Move glob_zero to .upper.bss" "-T msp430.ld --data-region=upper"
69     "" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
70   {"Move glob_zero to .upper.bss. No .lower.bss in ld script." "-T msp430-no-lower.ld --data-region=upper"
71     "" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
72   {"Move glob_zero to .lower.bss" "-T msp430.ld --data-region=lower"
73     "" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
74   {"Move \"either\" glob_zero to .lower.bss" "-T msp430.ld --data-region=lower"
75     "" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
77   {"Move glob_const to .upper.rodata" "-T msp430.ld --data-region=upper"
78     "" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
79   {"Move glob_const to .upper.rodata. No .lower.rodata in ld script." "-T msp430-no-lower.ld --data-region=upper"
80     "" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
81   {"Move glob_const to .lower.rodata" "-T msp430.ld --data-region=lower"
82     "" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
83   {"Move \"either\" glob_const to .lower.rodata" "-T msp430.ld --data-region=lower"
84     "" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
87 set msp430regionprefixuniquesectiontests {
88   {"Move main() to .upper.text, with -ffunction/data-sections" "-T msp430.ld --code-region=upper"
89     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"}
90   {"Move main() to .upper.text. No .lower.text in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --code-region=upper"
91     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"}
92   {"Move main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=lower"
93     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-lower"}
94   {"Move \"either\" main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=either"
95     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-either"}
97   {"Move glob_var to .upper.data, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
98     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
99   {"Move glob_var to .upper.data. No .lower.data in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
100     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
101   {"Move glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
102     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
103   {"Move \"either\" glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
104     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
106   {"Move glob_zero to .upper.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
107     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
108   {"Move glob_zero to .upper.bss. No .lower.bss in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
109     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
110   {"Move glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
111     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
112   {"Move \"either\" glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
113     "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
115   {"Move glob_const to .upper.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
116     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
117   {"Move glob_const to .upper.rodata. No .lower.rodata in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
118     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
119   {"Move glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
120     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
121   {"Move \"either\" glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
122     "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
125 set msp430eithershuffletests {
126   {"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text"
127     "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s}
128     {{objdump -d main-text-upper.d}} "either-to-upper-text"}
129   {"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data"
130     "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s}
131     {{objdump -D main-var-upper.d}} "either-to-upper-data"}
132   {"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss"
133     "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s}
134     {{objdump -D main-bss-upper.d}} "either-to-upper-bss"}
135   {"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata"
136     "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s}
137     {{objdump -D main-const-upper.d}} "either-to-upper-const"}
139   {"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text, with -ffunction/data-sections"
140     "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s}
141     {{objdump -d main-text-upper.d}} "either-to-upper-text-unique-sec"}
142   {"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data, with -ffunction/data-sections"
143     "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s}
144     {{objdump -D main-var-upper.d}} "either-to-upper-data-unique-sec"}
145   {"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss, with -ffunction/data-sections"
146     "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s}
147     {{objdump -D main-bss-upper.d}} "either-to-upper-bss-unique-sec"}
148   {"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata, with -ffunction/data-sections"
149     "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s}
150     {{objdump -D main-const-upper.d}} "either-to-upper-const-unique-sec"}
153 set msp430warntests {
154     {"Warn when section cannot be transformed because output section does not exist in linker script (text,data,bss,rodata)"
155         "-T msp430-no-lower.ld --code-region=lower --data-region=lower" "" "" {warn-no-lower.s}
156         {{ld warn-no-lower.r}} "warn-no-lower"}
157     {"Warn when section cannot be transformed because output section does not exist in linker script (text only)"
158         "-T msp430-no-lower.ld --code-region=lower" "" "" {warn-no-lower.s}
159         {{ld warn-no-lower-code.r}} "warn-no-lower-code"}
160     {"Warn when section cannot be transformed because output section does not exist in linker script (data,bss,rodata)"
161         "-T msp430-no-lower.ld --data-region=lower" "" "" {warn-no-lower.s}
162         {{ld warn-no-lower-data.r}} "warn-no-lower-data"}
165 # Don't run section shuffle tests when msp430 ISA is selected
166 if {[string match "*-mcpu=msp430 *" [board_info [target_info name] multilib_flags]]
167   || [string match "*-mcpu=msp430" [board_info [target_info name] multilib_flags]]} {
168     return
170 run_ld_link_tests $msp430regionprefixtests
171 run_ld_link_tests $msp430regionprefixuniquesectiontests
172 run_ld_link_tests $msp430eithershuffletests
173 run_ld_link_tests $msp430warntests
175 run_dump_test valid-map