diff options
author | Nick Clifton <nickc@redhat.com> | 2015-05-05 13:38:00 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-05-05 13:38:00 +0100 |
commit | 837a17b36c9e297f4bf33727e25dfa9f38360c17 (patch) | |
tree | 5cf6ecb482076cf1e20e437b6ea94c00c87cb103 /gas | |
parent | b76f99d702c3501ac320396ea06bc7f9237173c3 (diff) | |
download | fsf-binutils-gdb-837a17b36c9e297f4bf33727e25dfa9f38360c17.zip fsf-binutils-gdb-837a17b36c9e297f4bf33727e25dfa9f38360c17.tar.gz fsf-binutils-gdb-837a17b36c9e297f4bf33727e25dfa9f38360c17.tar.bz2 |
Add support to the MSP430 linker for the automatic placement of code and data into either low or high memory regions.
gas * config/tc-msp430.c (MAX_OP_LEN): Increase to 4096.
(msp430_make_init_symbols): New function.
(msp430_section): Call it.
(msp430_frob_section): Likewise.
ld * emulparams/msp430elf.sh (TEMPLATE_NAME): Change to msp430.
* scripttempl/msp430.sc (.text): Add .lower.text and .either.text.
(.data): Add .lower.data and .either.data.
(.bss): Add .lower.bss and .either.bss.
(.rodata): Add .lower.rodata and .either.rodata.
* emultempl/msp430.em: New file. Implements a new orphan
placement algorithm that divides sections between lower and upper
memory regions.
* Makefile.am (emsp430elf.c): Depend upon msp430.em.
*emsp430X.c): Likewise.
* Makefine.in: Regenerate.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-msp430.c | 40 |
2 files changed, 33 insertions, 14 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 13b6705..30831ae 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2015-05-05 Nick Clifton <nickc@redhat.com> + + * config/tc-msp430.c (MAX_OP_LEN): Increase to 4096. + (msp430_make_init_symbols): New function. + (msp430_section): Call it. + (msp430_frob_section): Likewise. + 2015-05-02 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (cached_fixupS, fixup_cacheS): New typedefs. diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 2891c13..5307746 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -255,7 +255,7 @@ relax_typeS md_relax_table[] = }; -#define MAX_OP_LEN 256 +#define MAX_OP_LEN 4096 typedef enum msp_isa { @@ -840,14 +840,11 @@ md_parse_option (int c, char * arg) The code which initializes these sections should have a global label for these symbols, and should be marked with KEEP() in the - linker script. - */ + linker script. */ + static void -msp430_section (int arg) +msp430_make_init_symbols (const char * name) { - char * saved_ilp = input_line_pointer; - char * name = obj_elf_section_name (); - if (strncmp (name, ".bss", 4) == 0 || strncmp (name, ".gnu.linkonce.b.", 16) == 0) (void) symbol_find_or_make ("__crt0_init_bss"); @@ -856,6 +853,27 @@ msp430_section (int arg) || strncmp (name, ".gnu.linkonce.d.", 16) == 0) (void) symbol_find_or_make ("__crt0_movedata"); + /* Note - data assigned to the .either.data section may end up being + placed in the .upper.data section if the .lower.data section is + full. Hence the need to define the crt0 symbol. */ + if (strncmp (name, ".either.data", 12) == 0 + || strncmp (name, ".upper.data", 11) == 0) + (void) symbol_find_or_make ("__crt0_move_highdata"); + + /* See note about .either.data above. */ + if (strncmp (name, ".upper.bss", 10) == 0 + || strncmp (name, ".either.bss", 11) == 0) + (void) symbol_find_or_make ("__crt0_init_highbss"); +} + +static void +msp430_section (int arg) +{ + char * saved_ilp = input_line_pointer; + char * name = obj_elf_section_name (); + + msp430_make_init_symbols (name); + input_line_pointer = saved_ilp; obj_elf_section (arg); } @@ -868,13 +886,7 @@ msp430_frob_section (asection *sec) if (sec->size == 0) return; - if (strncmp (name, ".bss", 4) == 0 - || strncmp (name, ".gnu.linkonce.b.", 16) == 0) - (void) symbol_find_or_make ("__crt0_init_bss"); - - if (strncmp (name, ".data", 5) == 0 - || strncmp (name, ".gnu.linkonce.d.", 16) == 0) - (void) symbol_find_or_make ("__crt0_movedata"); + msp430_make_init_symbols (name); } static void |