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

lld NOLOAD fix #64

Merged
merged 1 commit into from
Jun 5, 2020
Merged

Conversation

arcnmx
Copy link

@arcnmx arcnmx commented Jun 5, 2020

I'm hoping this is the right avenue to backport fixes like this...

Rust nightly 2020-05-22 and later ships lld with a regression related to linker scripts: NOLOAD sections incorrectly generate sections filled with 0s. This causes gdb and other elf loaders to write to reserved or otherwise invalid addresses (gdb also seems confused by the resulting ELF files and spits out a warning about the sections). This is particularly a problem for embedded rust projects that use lld by default and have affected linker scripts (cortex-m-rt based projects for instance).


[lld][ELF] Mark empty NOLOAD output sections SHT_NOBITS instead of SHT_PROGBITS

This fixes PR# 45336.
Output sections described in a linker script as NOLOAD with no input sections would be marked as SHT_PROGBITS.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D76981

…T_PROGBITS

This fixes PR# 45336.
Output sections described in a linker script as NOLOAD with no input sections would be marked as SHT_PROGBITS.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D76981
@nikic nikic merged commit 02e0d7f into rust-lang:rustc/10.0-2020-05-05 Jun 5, 2020
@nikic
Copy link

nikic commented Jun 5, 2020

Thanks! Please note that the llvm-project submodule in the main rust repo will need to be updated for this change to take effect.

@arcnmx
Copy link
Author

arcnmx commented Jun 5, 2020

Quick, thanks! Noted, will PR the submodule update as well.

bors pushed a commit to rust-lang-ci/rust that referenced this pull request Jun 7, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 7, 2020
Update LLVM submodule to include lld NOLOAD fix

> Rust nightly 2020-05-22 and later ships lld with a regression related to linker scripts: NOLOAD sections incorrectly generate sections filled with 0s. This causes gdb and other elf loaders to write to reserved or otherwise invalid addresses (gdb also seems confused by the resulting ELF files and spits out a warning about the sections). This is particularly a problem for embedded rust projects that use lld by default and have affected linker scripts (cortex-m-rt based projects for instance).

rust-lang/llvm-project#64

Note that this also pulls in llvm changes from rust-lang#72937
vext01 pushed a commit to vext01/llvm-project that referenced this pull request Apr 27, 2023
64: Make new stackmaps in the form LLVM expects. r=ltratt a=ptersilie



Co-authored-by: Lukas Diekmann <lukas.diekmann@gmail.com>
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.

3 participants