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

Explicitly set no ELF flags for .rustc section #92029

Merged
merged 1 commit into from
Dec 19, 2021

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Dec 17, 2021

For a data section, the object crate will set the SHF_ALLOC by default, which is exactly what we don't want. Explicitly set sh_flags to zero to avoid this.

I checked with objdump -h that this produces the right flags for ELF.

Fixes #92013.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 17, 2021
@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 17, 2021
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

r=me after CI passes

@nikic
Copy link
Contributor Author

nikic commented Dec 17, 2021

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Dec 17, 2021

📌 Commit 57c0cb7 has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 18, 2021
Use debug section for .rustc

For a data section, the object crate will set SHF_ALLOC by default, which is exactly what we don't want. Use a debug section instead, the same as we do for .rmeta.

I checked with `objdump -h` that this produces the right flags for ELF.

Fixes rust-lang#92013.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 18, 2021
Use debug section for .rustc

For a data section, the object crate will set SHF_ALLOC by default, which is exactly what we don't want. Use a debug section instead, the same as we do for .rmeta.

I checked with `objdump -h` that this produces the right flags for ELF.

Fixes rust-lang#92013.
@nikic
Copy link
Contributor Author

nikic commented Dec 18, 2021

@bors r- Failed in rollup #92053 on x86_64-apple:

2021-12-18T02:01:02.1067760Z �[0m          Undefined symbols for architecture x86_64:�[0m
2021-12-18T02:01:02.1068770Z �[0m            "_rust_metadata_std_b2211c67fb1edf70", referenced from:�[0m
2021-12-18T02:01:02.1069760Z �[0m               -exported_symbol[s_list] command line option�[0m
2021-12-18T02:01:02.1070720Z �[0m          ld: symbol(s) not found for architecture x86_64�[0m
2021-12-18T02:01:02.1071780Z �[0m          clang: error: linker command failed with exit code 1 (use -v to see invocation)�[0m

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 18, 2021
@nikic
Copy link
Contributor Author

nikic commented Dec 18, 2021

@bors try Let's see whether that makes it better or worse...

@bors
Copy link
Contributor

bors commented Dec 18, 2021

⌛ Trying commit 1b35977b8f16af8e28f5732df35ea8e23332973e with merge 0566d7bbe5b7f636a4f7f054d397634880ea4a67...

@nikic nikic force-pushed the section-flags-fix branch from 1b35977 to 2e56e0d Compare December 18, 2021 09:02
@nikic
Copy link
Contributor Author

nikic commented Dec 18, 2021

@bors try

@bors
Copy link
Contributor

bors commented Dec 18, 2021

⌛ Trying commit 2e56e0de86eaa8769873a2a7c7ed7fa91d1d7d84 with merge 3f2645cb3ad797a0fa23bed459b6be1d6daeb5b5...

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 18, 2021

💔 Test failed - checks-actions

@rust-log-analyzer

This comment has been minimized.

@nikic nikic force-pushed the section-flags-fix branch from 2e56e0d to 57223c4 Compare December 18, 2021 10:27
@nikic
Copy link
Contributor Author

nikic commented Dec 18, 2021

@bors try

@bors
Copy link
Contributor

bors commented Dec 18, 2021

⌛ Trying commit 57223c4f412596d16c7a3cb7dc913466fdeb4006 with merge 09ae9360e8f5e4649b589e052c5a68696bd2634f...

@bors
Copy link
Contributor

bors commented Dec 18, 2021

☀️ Try build successful - checks-actions
Build commit: 09ae9360e8f5e4649b589e052c5a68696bd2634f (09ae9360e8f5e4649b589e052c5a68696bd2634f)

For a data section, the object crate will set the SHF_ALLOC by
default, which is exactly what we don't want. Explicitly set
sh_flags to zero to avoid this.
@nikic nikic force-pushed the section-flags-fix branch from 57223c4 to 79d5309 Compare December 18, 2021 17:44
@nikic nikic changed the title Use debug section for .rustc Explicitly set no ELF flags for .rustc section Dec 18, 2021
@nikic
Copy link
Contributor Author

nikic commented Dec 18, 2021

Okay, the original idea of using a debug section didn't work out (as it appears to get discarded by linker with macho), so this instead explicitly sets the section flags to zero.

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 18, 2021

📌 Commit 79d5309 has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 19, 2021
…askrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#91791 (Fix an ICE when lowering a float with missing exponent magnitude)
 - rust-lang#91878 (Remove `in_band_lifetimes` from `rustc_infer`)
 - rust-lang#91895 (Remove `in_band_lifetimes` for `rustc_monomorphize`)
 - rust-lang#92029 (Explicitly set no ELF flags for .rustc section)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9415c67 into rust-lang:master Dec 19, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binary size regression in dylibs
6 participants