diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2019-10-07 16:34:31 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2019-10-07 16:34:31 +0100 |
commit | c0ea7c52e10024ecd29b8f0e23b666b6af926c6e (patch) | |
tree | 6be0be49c09e42f501772b4575576057ac57bc33 /ld | |
parent | Re: PowerPC PIC vs. DLL TLS issues (diff) | |
download | binutils-gdb-c0ea7c52e10024ecd29b8f0e23b666b6af926c6e.tar.gz binutils-gdb-c0ea7c52e10024ecd29b8f0e23b666b6af926c6e.tar.bz2 binutils-gdb-c0ea7c52e10024ecd29b8f0e23b666b6af926c6e.zip |
Add support for new functionality in the msp430 backend of GCC.
This functionality will generate a new GNU object attribute for the "data region"
has been added. This object attribute is used
mark whether the compiler has generated code assuming that data could be in the
upper or lower memory regions.
Code which assumes data is always in the lower memory region is incompatible
with code which uses the full memory range for data.
The patch also adds a new assembler directive ".mspabi_attribute" to handle the
existing MSPABI object attributes. GCC will now emit both .gnu_attribute and
.mspabi_attribute directives to indicate what options the source file was
compiled with.
The assembler will now check the values set in these directives against the
options that the it has been invoked with. If there is a discrepancy, the
assembler will exit with an error.
bfd * elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Rename to..
(elf32_msp430_merge_msp430_attributes): Add support for merging the GNU
object attribute for data region.
binutils* readelf.c (display_msp430_gnu_attribute): New.
(process_arch_specific): Use msp430 specific handler for GNU
attributes.
gas * config/tc-msp430.c (md_parse_option): Set lower_data_region_only to
FALSE if the data region is set to "upper", "either" or "none".
(msp430_object_attribute): New.
(md_pseudo_table): Handle .mspabi_attribute and .gnu_attribute.
(msp430_md_end): Replace hard-coded attribute values with enums.
Handle data region object attribute.
* doc/as.texi: Document MSP430 Data Region object attribute.
* doc/c-msp430.texi: Document the .mspabi_attribute directive.
* testsuite/gas/msp430/attr-430-small-bad.d: New test.
* testsuite/gas/msp430/attr-430-small-bad.l: New test.
* testsuite/gas/msp430/attr-430-small-good.d: New test.
* testsuite/gas/msp430/attr-430-small.s: New test.
* testsuite/gas/msp430/attr-430x-large-any-bad.d: New test.
* testsuite/gas/msp430/attr-430x-large-any-bad.l: New test.
* testsuite/gas/msp430/attr-430x-large-any-good.d: New test.
* testsuite/gas/msp430/attr-430x-large-any.s: New test.
* testsuite/gas/msp430/attr-430x-large-lower-bad.d: New test.
* testsuite/gas/msp430/attr-430x-large-lower-bad.l: New test.
* testsuite/gas/msp430/attr-430x-large-lower-good.d: New test.
* testsuite/gas/msp430/attr-430x-large-lower.s: New test.
* testsuite/gas/msp430/msp430.exp: Run new tests.
include * elf/msp430.h: Add enums for MSPABI and GNU object attribute tag names
and values.
ld * testsuite/ld-msp430-elf/attr-gnu-main.s: New test.
* testsuite/ld-msp430-elf/attr-gnu-obj.s: New test.
* testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d: New test.
* testsuite/ld-msp430-elf/attr-gnu-region-lower.d: New test.
* testsuite/ld-msp430-elf/attr-gnu-region-upper.d: New test.
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/attr-gnu-main.s | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/attr-gnu-obj.s | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/attr-gnu-region-lower.d | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/attr-gnu-region-upper.d | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-msp430-elf/msp430-elf.exp | 12 |
7 files changed, 61 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index ddec8c79ce3..a5457654088 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2019-10-07 Jozef Lawrynowicz <jozef.l@mittosystems.com> + + * testsuite/ld-msp430-elf/attr-gnu-main.s: New test. + * testsuite/ld-msp430-elf/attr-gnu-obj.s: New test. + * testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d: New test. + * testsuite/ld-msp430-elf/attr-gnu-region-lower.d: New test. + * testsuite/ld-msp430-elf/attr-gnu-region-upper.d: New test. + * testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests. + 2019-10-07 Alan Modra <amodra@gmail.com> * ldmisc.c (vfinfo): Save and restore bfd_error around bfd diff --git a/ld/testsuite/ld-msp430-elf/attr-gnu-main.s b/ld/testsuite/ld-msp430-elf/attr-gnu-main.s new file mode 100644 index 00000000000..e07a58ca709 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/attr-gnu-main.s @@ -0,0 +1,8 @@ +.text + .balign 2 + .global main + .type main, @function +main: +.L2: + BRA #.L2 + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/attr-gnu-obj.s b/ld/testsuite/ld-msp430-elf/attr-gnu-obj.s new file mode 100644 index 00000000000..d256e409c20 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/attr-gnu-obj.s @@ -0,0 +1,2 @@ +.text + .comm a,2,2 diff --git a/ld/testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d b/ld/testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d new file mode 100644 index 00000000000..70f8e350041 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d @@ -0,0 +1,6 @@ +#name: prevent merging of lower and upper attributes +#source: attr-gnu-main.s -ml -mdata-region=lower +#source: attr-gnu-obj.s -ml -mdata-region=upper +#ld: +#error: .*can use the upper region for data, but.*assumes data is exclusively in lower memory.* +#error: .*failed to merge target specific data of file.* diff --git a/ld/testsuite/ld-msp430-elf/attr-gnu-region-lower.d b/ld/testsuite/ld-msp430-elf/attr-gnu-region-lower.d new file mode 100644 index 00000000000..57345aadebd --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/attr-gnu-region-lower.d @@ -0,0 +1,12 @@ +#source: attr-gnu-main.s -ml -mdata-region=lower +#source: attr-gnu-obj.s -ml +#readelf: -A + +Attribute Section: mspabi +File Attributes + Tag_ISA: MSP430X + Tag_Code_Model: Large + Tag_Data_Model: Large +Attribute Section: gnu +File Attributes + Tag_GNU_MSP430_Data_Region: Lower Region Only diff --git a/ld/testsuite/ld-msp430-elf/attr-gnu-region-upper.d b/ld/testsuite/ld-msp430-elf/attr-gnu-region-upper.d new file mode 100644 index 00000000000..225968dc445 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/attr-gnu-region-upper.d @@ -0,0 +1,13 @@ +#source: attr-gnu-main.s -ml -mdata-region=upper +#source: attr-gnu-obj.s -ml -mdata-region=none +#ld: --data-region=either +#readelf: -A + +Attribute Section: mspabi +File Attributes + Tag_ISA: MSP430X + Tag_Code_Model: Large + Tag_Data_Model: Large +Attribute Section: gnu +File Attributes + Tag_GNU_MSP430_Data_Region: Any Region diff --git a/ld/testsuite/ld-msp430-elf/msp430-elf.exp b/ld/testsuite/ld-msp430-elf/msp430-elf.exp index b6f3151c80d..08620b57ff5 100644 --- a/ld/testsuite/ld-msp430-elf/msp430-elf.exp +++ b/ld/testsuite/ld-msp430-elf/msp430-elf.exp @@ -46,6 +46,7 @@ if { ![istarget "msp430*elf*"] } { # 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"} @@ -162,7 +163,7 @@ set msp430warntests { {{ld warn-no-lower-data.r}} "warn-no-lower-data"} } -# Don't run section shuffle tests when msp430 ISA is selected +# 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 @@ -173,3 +174,12 @@ run_ld_link_tests $msp430eithershuffletests run_ld_link_tests $msp430warntests run_dump_test valid-map + +# 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 |