mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-03-07 13:39:43 +08:00
ld * emultempl/msp430.em (change_output_section): New function. (move_prefixed_section): New function. (add_region_prefix): New function. (msp430_elf_after_open): New function. (gld${EMULATION_NAME}_add_options): Implement. (gld${EMULATION_NAME}_list_options): Implement. (gld${EMULATION_NAME}_handle_option): Implement. * ld.texinfo: Document new options. * testsuite/ld-msp430-elf/main-bss-lower.d: New. * testsuite/ld-msp430-elf/main-bss-upper.d: New. * testsuite/ld-msp430-elf/main-const-lower.d: New. * testsuite/ld-msp430-elf/main-const-upper.d: New. * testsuite/ld-msp430-elf/main-text-lower.d: New. * testsuite/ld-msp430-elf/main-text-upper.d: New. * testsuite/ld-msp430-elf/main-var-lower.d: New. * testsuite/ld-msp430-elf/main-var-upper.d: New. * testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s: New. * testsuite/ld-msp430-elf/main-with-data-bss.s: New. * testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s: New. * testsuite/ld-msp430-elf/main-with-text-rodata.s: New. * testsuite/ld-msp430-elf/msp430-elf.exp: New. * testsuite/ld-msp430-elf/msp430-no-lower.ld: New. * testsuite/ld-msp430-elf/msp430.ld: New. * emultempl/msp430.em (data_statement_size): New. (eval_upper_either_sections): New. (eval_lower_either_sections): New. (intermediate_relax_sections): New. (msp430_elf_after_allocation): New. * emultempl/msp430.em (gld${EMULATION_NAME}_place_orphan): Always place sections in the lower region. gas * config/tc-msp430.c (md_parse_option): Define high data and high bss symbols if -mdata-region is passed. Define -mdata-region open. * doc/c-msp430.texi: Document -mdata-region. * testsuite/gas/msp430/high-data-bss-sym.d: New test. * testsuite/gas/msp430/high-data-bss-sym.s: New. * testsuite/gas/msp430/msp430.exp: Add -mdata-region tests.
142 lines
9.5 KiB
Plaintext
142 lines
9.5 KiB
Plaintext
# Expect script for various MSP430 ELF tests.
|
|
# Copyright (C) 2002-2015 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 and one more item:
|
|
# 0:name 1:ld early options 2:ld late options 3:assembler options
|
|
# 4:filenames of assembler files 5: action and options. 6: name of output file
|
|
|
|
# Actions:
|
|
# objdump: Apply objdump options on result. Compare with regex (last arg).
|
|
# nm: Apply nm options on result. Compare with regex (last arg).
|
|
# readelf: Apply readelf options on result. Compare with regex (last arg).
|
|
|
|
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"}
|
|
}
|
|
|
|
run_ld_link_tests $msp430regionprefixtests
|
|
run_ld_link_tests $msp430regionprefixuniquesectiontests
|
|
run_ld_link_tests $msp430eithershuffletests
|