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 /gas/config/tc-msp430.c | |
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 'gas/config/tc-msp430.c')
-rw-r--r-- | gas/config/tc-msp430.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 91e0a73..62a34ed 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -676,6 +676,8 @@ static bfd_boolean warn_interrupt_nops = TRUE; #define OPTION_MCPU 'c' #define OPTION_MOVE_DATA 'd' static bfd_boolean move_data = FALSE; +#define OPTION_DATA_REGION 'r' +static bfd_boolean upper_data_region_in_use = FALSE; enum { @@ -1448,6 +1450,12 @@ md_parse_option (int c, const char * arg) case OPTION_MOVE_DATA: move_data = TRUE; return 1; + + case OPTION_DATA_REGION: + if (strcmp (arg, "upper") == 0 + || strcmp (arg, "either") == 0) + upper_data_region_in_use = TRUE; + return 1; } return 0; @@ -1478,14 +1486,19 @@ msp430_make_init_symbols (const char * name) /* 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. */ + full. Hence the need to define the crt0 symbol. + The linker may create upper or either data sections, even when none exist + at the moment, so use the value of the data-region flag to determine if + the symbol is needed. */ if (strncmp (name, ".either.data", 12) == 0 - || strncmp (name, ".upper.data", 11) == 0) + || strncmp (name, ".upper.data", 11) == 0 + || upper_data_region_in_use) (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) + || strncmp (name, ".either.bss", 11) == 0 + || upper_data_region_in_use) (void) symbol_find_or_make ("__crt0_init_highbss"); } @@ -1570,6 +1583,7 @@ struct option md_longopts[] = {"mY", no_argument, NULL, OPTION_NO_WARN_INTR_NOPS}, {"my", no_argument, NULL, OPTION_WARN_INTR_NOPS}, {"md", no_argument, NULL, OPTION_MOVE_DATA}, + {"mdata-region", required_argument, NULL, OPTION_DATA_REGION}, {NULL, no_argument, NULL, 0} }; @@ -1601,6 +1615,9 @@ md_show_usage (FILE * stream) _(" -my - warn about missing NOPs after changing interrupts (default)\n")); fprintf (stream, _(" -md - Force copying of data from ROM to RAM at startup\n")); + fprintf (stream, + _(" -mdata-region={none|lower|upper|either} - select region data will be\n" + " placed in.\n")); } symbolS * |