[PATCH] [MSP430] [LD] Leave placement of .lower and .upper sections to generic linker code

Jozef Lawrynowicz jozef.l@mittosystems.com
Tue Apr 16 20:44:00 GMT 2019


The MSP430 linker has the functionality to "shuffle" function and data
sections between upper and lower memory, if the lower memory region overflows
and --{code,data}-region=either is passed to ld.

The --{code,data}-region= options also accept values of "upper" and "lower",
and for these options, it will add ".upper" or ".lower" prefixes to
input section names.

Currently, the code also tries to move these ".upper" and ".lower"
prefixed sections to an assumed output section, based on the input
section name (e.g. .upper.data.foo -> .upper.data). This means the actual input
section rules in the linker script are ignored.
The patch fixes this by renaming the section in these situations using
bfd_rename_section, then leaving the generic parts of the linker to place the
section in the correct output section.

Furthermore, some erroneous free()s of the variables containing the newly
prefixed section names cause the section names in the map file to appear as
random garbage.

The attached patch fixes these issues and adds tests. The ld testsuite now
runs clean for msp430-elf.

If the patch is acceptable, I would appreciate if someone would commit it for
me, as I do not have write access.

Thanks,
Jozef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-MSP430-Leave-placement-of-.lower-and-.upper-sections.patch
Type: text/x-patch
Size: 15725 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20190416/1b3cc7b1/attachment.bin>


More information about the Binutils mailing list