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

Mark ___asan_globals_registered as an exported symbol for LTO #114642

Closed
wants to merge 2 commits into from

Conversation

anforowicz
Copy link
Contributor

@anforowicz anforowicz commented Aug 8, 2023

Export a weak symbol defined by AddressSanitizer instrumentation.
Previously, when using LTO, the symbol would get internalized and eliminated.

Fixes #113404.


FWIW, let me list similar PRs from the past + who reviewed them:

@rustbot
Copy link
Collaborator

rustbot commented Aug 8, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @TaKO8Ki (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 8, 2023
@anforowicz anforowicz marked this pull request as ready for review August 9, 2023 16:16
@tmiasko
Copy link
Contributor

tmiasko commented Aug 11, 2023

Thanks.

r? @tmiasko @bors r+

@bors
Copy link
Contributor

bors commented Aug 11, 2023

📌 Commit 73b5842 has been approved by tmiasko

It is now in the queue for this repository.

@rustbot rustbot assigned tmiasko and unassigned TaKO8Ki Aug 11, 2023
@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 Aug 11, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 11, 2023
Mark `___asan_globals_registered` as an exported symbol for LTO

Export a weak symbol defined by AddressSanitizer instrumentation.
Previously, when using LTO, the symbol would get internalized and eliminated.

Fixes rust-lang#113404.

---------------

FWIW, let me list similar PRs from the past + who reviewed them:

* rust-lang#68410 (fixing `__msan_keep_going` and `__msan_track_origins`; reviewed by `@varkor)`
* rust-lang#60038 and rust-lang#48346 (fixing `__llvm_profile_raw_version` and `__llvm_profile_filename`; reviewed by `@alexcrichton)`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 12, 2023
Mark `___asan_globals_registered` as an exported symbol for LTO

Export a weak symbol defined by AddressSanitizer instrumentation.
Previously, when using LTO, the symbol would get internalized and eliminated.

Fixes rust-lang#113404.

---------------

FWIW, let me list similar PRs from the past + who reviewed them:

* rust-lang#68410 (fixing `__msan_keep_going` and `__msan_track_origins`; reviewed by ``@varkor)``
* rust-lang#60038 and rust-lang#48346 (fixing `__llvm_profile_raw_version` and `__llvm_profile_filename`; reviewed by ``@alexcrichton)``
@matthiaskrgr
Copy link
Member

@bors r-
failed in #114751 (comment)

@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 Aug 12, 2023
@anforowicz
Copy link
Contributor Author

Thanks for reporting the test failure in #114751 (comment). The problem seems obvious in retrospect - on arm-android bot the LLVM-IR says:

@___asan_globals_registered = common hidden global i32 0

and the test expects almost the same line, but with i64 instead of i32.

Let me relax the test expectations and ping you when the PR has been updated...

@anforowicz
Copy link
Contributor Author

@tmiasko and/or @matthiaskrgr - could you PTAL again?

@tmiasko
Copy link
Contributor

tmiasko commented Aug 14, 2023

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Aug 14, 2023

📌 Commit 633b4551832e83342e59abcf52d891f4ec82e299 has been approved by tmiasko

It is now in the queue for this repository.

@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 Aug 14, 2023
@bors
Copy link
Contributor

bors commented Aug 14, 2023

⌛ Testing commit 633b4551832e83342e59abcf52d891f4ec82e299 with merge 254538cb341f6aecb004662528685be25202831d...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 14, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 14, 2023
@tmiasko
Copy link
Contributor

tmiasko commented Aug 16, 2023

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Aug 16, 2023

📌 Commit bf9820e6fef8f8c06604b5673f36e33d94ed4c25 has been approved by tmiasko

It is now in the queue for this repository.

@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 Aug 16, 2023
@bors
Copy link
Contributor

bors commented Aug 16, 2023

⌛ Testing commit bf9820e6fef8f8c06604b5673f36e33d94ed4c25 with merge a9721fbd74af81a9f912673e5138da0847c8c9b3...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 16, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 16, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 28, 2023

These commits modify compiler targets.
(See the Target Tier Policy.)

@anforowicz
Copy link
Contributor Author

@tmiasko - can you PTAL again? This probably needs a quick re-review (to look at the new pub fn binary_format() in impl TargetOptions ), but maybe this is otherwise ready for another try via @bors r+ rollup=never. WDYT?

@bors
Copy link
Contributor

bors commented Aug 28, 2023

@anforowicz: 🔑 Insufficient privileges: Not in reviewers

@tmiasko
Copy link
Contributor

tmiasko commented Aug 28, 2023

In this approach we would also have to replicate remaining conditions that control whether ___asan_globals_registered is used, including ShouldUseMachOGlobalsSection and !getUniqueModuleId(&M).empty(). The latter seems especially problematic since it depends on the contents of the module.

At the moment I don't have alternative suggestions, short of disabling UseGlobalGC.

@anforowicz
Copy link
Contributor Author

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Aug 29, 2023
@bors
Copy link
Contributor

bors commented Sep 6, 2023

☔ The latest upstream changes (presumably #114946) made this pull request unmergeable. Please resolve the merge conflicts.

@anforowicz
Copy link
Contributor Author

This PR has been made obsolete by #114946

@anforowicz anforowicz closed this Sep 6, 2023
@anforowicz anforowicz deleted the fix-asan-lto branch February 16, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

__asan_globals_registered is not comdat when building a staticlib with LTO
7 participants