Skip to content

[Driver] TSan runtime now has a link-time dependency on libdispatch #23645

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 1 commit into from
Apr 1, 2019

Conversation

yln
Copy link
Contributor

@yln yln commented Mar 29, 2019

Previously, the TSan runtime only required libdispatch on Darwin, which
required no explicit linker flags, because libdispatch is always
provided by the system (via libSystem).

Now, the TSan runtime also has a link-time dependency on libdispatch on
Linux, where libdispatch (and the blocks runtime) is just another
library. We therefore need to specify them as additional linker options.

Previously, the TSan runtime only required libdispatch on Darwin, which
required no explicit linker flags, because libdispatch is always
provided by the system (libSystem).

Now, the TSan runtime also has a link-time dependency on libdispatch on
Linux, where libdispatch (and the blocks runtime) is just another
library. We therefore need to specify them as additonal linker options.
@yln yln self-assigned this Mar 29, 2019
@yln
Copy link
Contributor Author

yln commented Mar 29, 2019

@swift-ci please test


// The TSan runtime depends on the blocks runtime and libdispatch.
if (context.OI.SelectedSanitizers & SanitizerKind::Thread) {
Arguments.push_back("-lBlocksRuntime");
Copy link
Member

Choose a reason for hiding this comment

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

This is slightly worrisome. -fblocks-runtime-optional controls where you have a blocks runtime library or not that you link against. (The GNU ObjC runtime also provides the blocks runtime implicitly). I wish that we could delegate to the clang driver for the blocks runtime linkage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[...] delegate to the clang driver for the blocks runtime linkage.

This is what I am trying to do here. I don't really understand what you mean. What should we do instead?

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 1cac0be

@yln
Copy link
Contributor Author

yln commented Mar 29, 2019

@swift-ci please test Linux

@yln yln merged commit da45361 into master Apr 1, 2019
@yln yln deleted the driver-tsan-linux-linker-flags branch April 1, 2019 22:20
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.

4 participants