Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linker script MEMORY section #32

Open
mikedilger opened this issue Apr 24, 2021 · 0 comments
Open

linker script MEMORY section #32

mikedilger opened this issue Apr 24, 2021 · 0 comments

Comments

@mikedilger
Copy link

mikedilger commented Apr 24, 2021

Just thought I'd mention that the MEMORY flags (airwx) don't mean what your comment implies. They don't apply to the memory, they apply to the section being allocated in that memory. It means something like this: 'allow sections that I didn't mention below and which have these flags set to be placed within this region of memory'.

Given your script, if an input file has a read only section or an initialized section and you didn't mention it in SECTIONS, and you put !r or !i in the memory flags, it will get discarded because there is no place for it.

Actually... since you are no longer inverting (!ri) I suppose the linker may put them in there anyways. But I'd change it to 'airwx' just to be safe. UPDATE: for some reason rust-lld doesn't accept 'i' or it's alias 'l'.

BTW: thanks for this OS blog, it's very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant