Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Place undefined globals in .bss instead of .data #109

Merged

Conversation

varkor
Copy link
Member

@varkor varkor commented Mar 9, 2018

Merge the fix for rust-lang/rust#41315, moving undefined global constants to the bss section instead of the data section.

cc @japaric

Following up on the discussion from
http://lists.llvm.org/pipermail/llvm-dev/2017-April/112305.html, undef
values are now placed in the .bss as well as null values. This prevents
undef global values taking up potentially huge amounts of space in the
.data section.

The following two lines now both generate equivalent .bss data:

@vals1 = internal unnamed_addr global [20000000 x i32] zeroinitializer, align 4
@Vals2 = internal unnamed_addr global [20000000 x i32] undef, align 4 ; previously unaccounted for

This is primarily motivated by the corresponding issue in the Rust
compiler (rust-lang/rust#41315).

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

Patch by varkor!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324424 91177308-0d34-0410-b5e6-96231b3b80d8
@japaric
Copy link
Member

japaric commented Mar 9, 2018

r? @alexcrichton

(I can't merge PRs in this repo :-)

@alexcrichton
Copy link
Member

Awesome, thanks! Would it be possible to upstream this to LLVM first though?

@japaric
Copy link
Member

japaric commented Mar 10, 2018

@alexcrichton This has already been merged upstream:

commit: https://reviews.llvm.org/rL324424

review: https://reviews.llvm.org/D41705

@alexcrichton
Copy link
Member

Oh! Sorry I forgot to expand the commit message here... In that case!

@alexcrichton alexcrichton merged commit 6ceaaa4 into rust-lang:rust-llvm-release-6-0-0 Mar 10, 2018
@japaric
Copy link
Member

japaric commented Mar 10, 2018

Thanks @alexcrichton!

@varkor you can now prepare a rust-lang/rust PR that updates the LLVM submodule

@varkor varkor deleted the bss-undefined-globals branch March 10, 2018 10:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants