Skip to content

Conversation

jnohlgard
Copy link
Member

Contribution description

Using attributes (rx) on only the ROM segment will make the linker use that segment for orphan sections with read-only or executable contents.
Having a correct default placement for read-only and executable sections makes it easier to write augmentation ldscripts for adding more sections, such as XFA (#7523), because the linker will then place any added sections in ROM.
Any writable sections which need relocating during boot still needs the > ram AT> rom specifications like it is done in the platform specific ldscripts.

Quote GNU ld manual https://sourceware.org/binutils/docs/ld/MEMORY.html

The attr string is an optional list of attributes that specify whether to use a particular memory region for an input section which is not explicitly mapped in the linker script. As described in SECTIONS, if you do not specify an output section for some input section, the linker will create an output section with the same name as the input section. If you define region attributes, the linker will use them to select the memory region for the output section that it creates.

Issues/PRs references

based on #9084
useful in #7523
https://sourceware.org/binutils/docs/ld/MEMORY.html

@jnohlgard jnohlgard added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 7, 2018
@jnohlgard jnohlgard added this to the Release 2018.07 milestone May 7, 2018
@jnohlgard jnohlgard requested a review from haukepetersen May 7, 2018 06:41
@jnohlgard jnohlgard force-pushed the pr/ldscript-attrs branch from 6df8d97 to 611729a Compare May 7, 2018 07:03
Copy link
Contributor

@kYc0o kYc0o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Though the extra sections in some ldscripts are not used, I agree the most important it's the (!rx) field.

@kaspar030 kaspar030 added CI: run tests If set, CI server will run tests on hardware for the labeled PR CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 7, 2018
@jnohlgard jnohlgard force-pushed the pr/ldscript-attrs branch from 611729a to 35eeac1 Compare May 8, 2018 09:33
@jnohlgard jnohlgard force-pushed the pr/ldscript-attrs branch from 35eeac1 to 19061b2 Compare May 8, 2018 22:41
@kaspar030 kaspar030 merged commit 83e8a52 into RIOT-OS:master May 9, 2018
@jnohlgard jnohlgard deleted the pr/ldscript-attrs branch May 13, 2018 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants