1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
# Expect script for various MSP430 ELF tests.
# Copyright (C) 2002-2020 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
if { ![istarget "msp430*elf*"] } {
return
}
# List contains test-items with 3 items followed by 2 lists, one item and
# one optional item:
# 0:name
# 1:ld/ar leading options, placed before object files
# 2:ld/ar trailing options, placed after object files
# 3:assembler options
# 4:filenames of assembler files
# 5:list of actions, options and expected outputs.
# 6:name of output file
# 7:compiler flags (optional)
#
# Actions: { command command-line-options file-containg-expected-output-regexps }
# Commands:
# objdump: Apply objdump options on result.
# nm: Apply nm options on result.
# readelf: Apply readelf options on result.
# ld: Don't apply anything on result. Compare output during linking with
# the file containing regexps (which is the second arg, not the third).
# Note that this *must* be the first action if it is to be used at all;
# in all other cases, any output from the linker during linking is
# treated as a sign of an error and FAILs the test.
#
#
set msp430regionprefixtests {
{"Move main() to .upper.text" "-T msp430.ld --code-region=upper"
"" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"}
{"Move main() to .upper.text. No .lower.text in ld script" "-T msp430-no-lower.ld --code-region=upper"
"" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"}
{"Move main() to .lower.text" "-T msp430.ld --code-region=lower"
"" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-lower"}
{"Move \"either\" main() to .lower.text" "-T msp430.ld --code-region=either"
"" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-either"}
{"Move glob_var to .upper.data" "-T msp430.ld --data-region=upper"
"" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
{"Move glob_var to .upper.data. No .lower.data in ld script" "-T msp430-no-lower.ld --data-region=upper"
"" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
{"Move glob_var to .lower.data" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
{"Move \"either\" glob_var to .lower.data" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
{"Move glob_zero to .upper.bss" "-T msp430.ld --data-region=upper"
"" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
{"Move glob_zero to .upper.bss. No .lower.bss in ld script." "-T msp430-no-lower.ld --data-region=upper"
"" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
{"Move glob_zero to .lower.bss" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
{"Move \"either\" glob_zero to .lower.bss" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
{"Move glob_const to .upper.rodata" "-T msp430.ld --data-region=upper"
"" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
{"Move glob_const to .upper.rodata. No .lower.rodata in ld script." "-T msp430-no-lower.ld --data-region=upper"
"" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
{"Move glob_const to .lower.rodata" "-T msp430.ld --data-region=lower"
"" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
{"Move \"either\" glob_const to .lower.rodata" "-T msp430.ld --data-region=lower"
"" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
}
set msp430regionprefixuniquesectiontests {
{"Move main() to .upper.text, with -ffunction/data-sections" "-T msp430.ld --code-region=upper"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"}
{"Move main() to .upper.text. No .lower.text in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --code-region=upper"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"}
{"Move main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=lower"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-lower"}
{"Move \"either\" main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=either"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-either"}
{"Move glob_var to .upper.data, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
{"Move glob_var to .upper.data. No .lower.data in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"}
{"Move glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
{"Move \"either\" glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"}
{"Move glob_zero to .upper.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
{"Move glob_zero to .upper.bss. No .lower.bss in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"}
{"Move glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
{"Move \"either\" glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
"" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"}
{"Move glob_const to .upper.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=upper"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
{"Move glob_const to .upper.rodata. No .lower.rodata in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"}
{"Move glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
{"Move \"either\" glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower"
"" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"}
}
set msp430eithershuffletests {
{"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text"
"-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s}
{{objdump -d main-text-upper.d}} "either-to-upper-text"}
{"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data"
"-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s}
{{objdump -D main-var-upper.d}} "either-to-upper-data"}
{"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss"
"-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s}
{{objdump -D main-bss-upper.d}} "either-to-upper-bss"}
{"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata"
"-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s}
{{objdump -D main-const-upper.d}} "either-to-upper-const"}
{"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text, with -ffunction/data-sections"
"-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s}
{{objdump -d main-text-upper.d}} "either-to-upper-text-unique-sec"}
{"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data, with -ffunction/data-sections"
"-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s}
{{objdump -D main-var-upper.d}} "either-to-upper-data-unique-sec"}
{"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss, with -ffunction/data-sections"
"-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s}
{{objdump -D main-bss-upper.d}} "either-to-upper-bss-unique-sec"}
{"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata, with -ffunction/data-sections"
"-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s}
{{objdump -D main-const-upper.d}} "either-to-upper-const-unique-sec"}
}
set msp430warntests {
{"Warn when section cannot be transformed because output section does not exist in linker script (text,data,bss,rodata)"
"-T msp430-no-lower.ld --code-region=lower --data-region=lower" "" "" {warn-no-lower.s}
{{ld warn-no-lower.r}} "warn-no-lower"}
{"Warn when section cannot be transformed because output section does not exist in linker script (text only)"
"-T msp430-no-lower.ld --code-region=lower" "" "" {warn-no-lower.s}
{{ld warn-no-lower-code.r}} "warn-no-lower-code"}
{"Warn when section cannot be transformed because output section does not exist in linker script (data,bss,rodata)"
"-T msp430-no-lower.ld --data-region=lower" "" "" {warn-no-lower.s}
{{ld warn-no-lower-data.r}} "warn-no-lower-data"}
}
# Don't run further tests when msp430 ISA is selected
if {[string match "*-mcpu=msp430 *" [board_info [target_info name] multilib_flags]]
|| [string match "*-mcpu=msp430" [board_info [target_info name] multilib_flags]]} {
return
}
run_ld_link_tests $msp430regionprefixtests
run_ld_link_tests $msp430regionprefixuniquesectiontests
run_ld_link_tests $msp430eithershuffletests
run_ld_link_tests $msp430warntests
run_dump_test valid-map
run_ld_link_tests {{ "Check no reloc overflow with #lo and data in the upper region"
"-m msp430X" "" "" {reloc-lo-430x.s} {} "reloc-lo-430x"}}
run_ld_link_tests {{ "Check .upper prefixed input sections can be placed"
"-m msp430X" "" "" {upper-input-sections.s} {} "upper-input-sections"}}
# Don't run data region tests if a data region is specified
if {[string match "*-mdata-region*" [board_info [target_info name] multilib_flags]]} {
return
}
# GNU object attribute dump tests
run_dump_test attr-gnu-region-lower
run_dump_test attr-gnu-region-upper
run_dump_test attr-gnu-region-lower-upper
|