8000 Make: Use -nmagic linker flag by bradjc · Pull Request #2336 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make: Use -nmagic linker flag #2336

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

Merged
merged 2 commits into from
Jan 11, 2021
Merged

Make: Use -nmagic linker flag #2336

merged 2 commits into from
Jan 11, 2021

Conversation

bradjc
Copy link
Contributor
@bradjc bradjc commented Jan 8, 2021

Pull Request Overview

This fixes #2219. After looking through the relevant discussions, --nmagic is the flag I should have used when original converting from gcc to llvm linkers. Setting the page size to a small value was a convenient workaround, but what we really wanted was for there to just not be padding.

Also I documented the -icf flag.

Testing Strategy

Comparing kernel binaries before and after this change and verifying they are identical.

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

bradjc added 2 commits January 8, 2021 14:43
Previously we told the linker the page size was small so that it would
in effect remove any padding between program sections. This was a hack
when switching linkers, but the proper way to do this is using the
"-nmagic" flag which explicitly tells the linker to not align sections
to page sizes.

Some relevant discussions:
- rust-embedded/cortex-m-quickstart#95 (comment)
- #2180

Also copying in the linker docs which might be useful:

```
$ ld.lld --help | grep magic
  --nmagic                Do not page align sections, link against static libraries.
  --no-nmagic             Page align sections (default)
  --no-omagic             Do not set the text data sections to be writable, page align sections (default)
  -N                      Alias for --omagic
  -n                      Alias for --nmagic
  --omagic                Set the text and data sections to be readable and writable, do not page align sections, link against static libraries
```

Fixes #2219
@alevy
Copy link
Member
alevy commented Jan 11, 2021

bors r+

@bors
Copy link
Contributor
bors bot commented Jan 11, 2021

Build failed (retrying...):

@bors
Copy link
Contributor
bors bot commented Jan 11, 2021

This PR was included in a batch that successfully built, but then failed to merge into master (it was a non-fast-forward update). It will be automatically retried.

@bors
Copy link
Contributor
bors bot commented Jan 11, 2021

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

Successfully merging this pull request may close these issues.

Don't tie linker args to sam4l page size
4 participants
0