diff options
author | Jozef Lawrynowicz <jozef.l@somniumtech.com> | 2017-08-29 17:18:43 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-08-29 17:18:43 +0100 |
commit | 7ef3addbe195b6283d0baf59e081146dfb211c97 (patch) | |
tree | c201cf7915b7d05e32742dc90d4c0716e62babcf /ld/testsuite/ld-msp430-elf | |
parent | 3819af136deb7ba6bc2058d7848cf80b33dbe51c (diff) | |
download | gdb-7ef3addbe195b6283d0baf59e081146dfb211c97.zip gdb-7ef3addbe195b6283d0baf59e081146dfb211c97.tar.gz gdb-7ef3addbe195b6283d0baf59e081146dfb211c97.tar.bz2 |
Improve MSP430 section placement.
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.
Diffstat (limited to 'ld/testsuite/ld-msp430-elf')
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-bss-lower.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-bss-upper.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-const-lower.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-const-upper.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-text-lower.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-text-upper.d | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-var-lower.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-var-upper.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s | 78 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-with-data-bss.s | 74 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s | 59 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/main-with-text-rodata.s | 59 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/msp430-elf.exp | 141 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/msp430-no-lower.ld | 54 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/msp430-tiny-ram.ld | 49 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/msp430-tiny-rom.ld | 48 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/msp430.ld | 78 |
17 files changed, 667 insertions, 0 deletions
diff --git a/ld/testsuite/ld-msp430-elf/main-bss-lower.d b/ld/testsuite/ld-msp430-elf/main-bss-lower.d new file mode 100644 index 0000000..6007420 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-bss-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.bss: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-bss-upper.d b/ld/testsuite/ld-msp430-elf/main-bss-upper.d new file mode 100644 index 0000000..2f6376a7 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-bss-upper.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .upper.bss: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-const-lower.d b/ld/testsuite/ld-msp430-elf/main-const-lower.d new file mode 100644 index 0000000..8549961 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-const-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.rodata: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-const-upper.d b/ld/testsuite/ld-msp430-elf/main-const-upper.d new file mode 100644 index 0000000..c84d649 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-const-upper.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .upper.rodata: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-text-lower.d b/ld/testsuite/ld-msp430-elf/main-text-lower.d new file mode 100644 index 0000000..446a305 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-text-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.text: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-text-upper.d b/ld/testsuite/ld-msp430-elf/main-text-upper.d new file mode 100644 index 0000000..f7ae6af --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-text-upper.d @@ -0,0 +1,6 @@ + +.*: file format.*msp430.* + + +Disassembly of section .upper.text: +#... diff --git a/ld/testsuite/ld-msp430-elf/main-var-lower.d b/ld/testsuite/ld-msp430-elf/main-var-lower.d new file mode 100644 index 0000000..f520cf5 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-var-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.data: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-var-upper.d b/ld/testsuite/ld-msp430-elf/main-var-upper.d new file mode 100644 index 0000000..fc3d712 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-var-upper.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .upper.data: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s b/ld/testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s new file mode 100644 index 0000000..7774804 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s @@ -0,0 +1,78 @@ + .file "main-with-data-bss.c" + .global glob_var_array + .section .data.glob_var_array,"aw",@progbits + .balign 2 + .type glob_var_array, @object + .size glob_var_array, 20 +glob_var_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 + .section .bss.glob_bss_array,"aw",@nobits + .balign 2 + .type glob_bss_array, @object + .size glob_bss_array, 20 +glob_bss_array: + .zero 20 + .section .text.main,"ax",@progbits + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L7: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_var_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_bss_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L5 +.L6: + BR #.L6 +.L5: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L7 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/main-with-data-bss.s b/ld/testsuite/ld-msp430-elf/main-with-data-bss.s new file mode 100644 index 0000000..a406b64 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-data-bss.s @@ -0,0 +1,74 @@ + .file "main-with-data-bss.c" + .global glob_var_array +.data + .balign 2 + .type glob_var_array, @object + .size glob_var_array, 20 +glob_var_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 + .local glob_bss_array + .comm glob_bss_array,20,2 +.text + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L7: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_var_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_bss_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L5 +.L6: + BR #.L6 +.L5: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L7 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s b/ld/testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s new file mode 100644 index 0000000..398cf74 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s @@ -0,0 +1,59 @@ + .file "main-with-text-rodata.c" + .global glob_const_array + .section .rodata.glob_const_array,"a",@progbits + .balign 2 + .type glob_const_array, @object + .size glob_const_array, 20 +glob_const_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 + .section .text.main,"ax",@progbits + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L5: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_const_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L5 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/main-with-text-rodata.s b/ld/testsuite/ld-msp430-elf/main-with-text-rodata.s new file mode 100644 index 0000000..225b5d4 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-text-rodata.s @@ -0,0 +1,59 @@ + .file "main-with-text-rodata.c" + .global glob_const_array + .section .rodata + .balign 2 + .type glob_const_array, @object + .size glob_const_array, 20 +glob_const_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 +.text + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L5: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_const_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L5 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/msp430-elf.exp b/ld/testsuite/ld-msp430-elf/msp430-elf.exp new file mode 100644 index 0000000..fa396aa --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-elf.exp @@ -0,0 +1,141 @@ +# 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 diff --git a/ld/testsuite/ld-msp430-elf/msp430-no-lower.ld b/ld/testsuite/ld-msp430-elf/msp430-no-lower.ld new file mode 100644 index 0000000..f9a2847 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-no-lower.ld @@ -0,0 +1,54 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +SECTIONS +{ + .text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } + + .rodata : + { + *(.rodata.* .rodata) + } + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } + + .upper.text : + { + . = ALIGN(2); + *(.upper.text.* .upper.text) + } + + .upper.rodata : + { + . = ALIGN(2); + *(.upper.rodata .upper.rodata.*) + } + + .upper.data : + { + . = ALIGN(2); + *(.upper.data .upper.data.*) + } + + .upper.bss : + { + . = ALIGN(2); + *(.upper.bss .upper.bss.*) + } +} diff --git a/ld/testsuite/ld-msp430-elf/msp430-tiny-ram.ld b/ld/testsuite/ld-msp430-elf/msp430-tiny-ram.ld new file mode 100644 index 0000000..e2e6f2f --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-tiny-ram.ld @@ -0,0 +1,49 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +MEMORY +{ + RAM : ORIGIN = 0x0, LENGTH = 0x2 + ROM : ORIGIN = 0x2, LENGTH = 0x1fe + HIFRAM : ORIGIN = 0x200, LENGTH = 0x1000 +} + +SECTIONS +{ + .text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } > ROM + + .rodata : + { + *(.upper.rodata.* .rodata) + } > ROM + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } > RAM AT> ROM + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } > RAM + + .upper.data : + { + . = ALIGN(2); + *(.upper.data.* .upper.data) + } > HIFRAM AT> ROM + + .upper.bss : + { + . = ALIGN(2); + *(.upper.bss.* .upper.bss) + } > HIFRAM +} diff --git a/ld/testsuite/ld-msp430-elf/msp430-tiny-rom.ld b/ld/testsuite/ld-msp430-elf/msp430-tiny-rom.ld new file mode 100644 index 0000000..3e26379 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-tiny-rom.ld @@ -0,0 +1,48 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +MEMORY +{ + ROM : ORIGIN = 0x0, LENGTH = 0x2 + RAM : ORIGIN = 0x2, LENGTH = 0x1fe + HIROM : ORIGIN = 0x200, LENGTH = 0x1000 +} + +SECTIONS +{ + .text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } > ROM + + .rodata : + { + *(.rodata.* .rodata) + } > ROM + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } > RAM AT> ROM + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } > RAM + + .upper.text : + { + . = ALIGN(2); + *(.upper.text.* .upper.text) + } > HIROM + + .upper.rodata : + { + *(.upper.rodata.* .upper.rodata) + } > HIROM +} diff --git a/ld/testsuite/ld-msp430-elf/msp430.ld b/ld/testsuite/ld-msp430-elf/msp430.ld new file mode 100644 index 0000000..9c30836 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430.ld @@ -0,0 +1,78 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +SECTIONS +{ + .lower.data : + { + . = ALIGN(2); + *(.lower.data .lower.data.*) + } + + .lower.bss : + { + . = ALIGN(2); + *(.lower.bss .lower.bss.*) + } + + .lower.text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.lower.text.* .lower.text) + } + + .lower.rodata : + { + . = ALIGN(2); + *(.lower.rodata .lower.rodata.*) + } + + .text : + { + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } + + .rodata : + { + *(.rodata.* .rodata) + } + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } + + .upper.text : + { + . = ALIGN(2); + *(.upper.text.* .upper.text) + } + + .upper.rodata : + { + . = ALIGN(2); + *(.upper.rodata .upper.rodata.*) + } + + .upper.data : + { + . = ALIGN(2); + *(.upper.data .upper.data.*) + } + + .upper.bss : + { + . = ALIGN(2); + *(.upper.bss .upper.bss.*) + } +} |