-
Notifications
You must be signed in to change notification settings - Fork 196
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
Propagate sanitizer arguments to the clang-linker-driver invocations for dynamic libraries #1325
Conversation
…for dynamic libraries Unless we are building a static library, we need to propagate `-fsanitizer=` flag to the clang linker driver, otherwise sanitizers libraries will not be found at link-time. Resolves rdar://107733898
ceef248
to
e769d62
Compare
@@ -199,7 +199,7 @@ extension DarwinToolchain { | |||
// Linking sanitizers will add rpaths, which might negatively interact when | |||
// other rpaths are involved, so we should make sure we add the rpaths after | |||
// all user-specified rpaths. | |||
if linkerOutputType == .executable && !sanitizers.isEmpty { | |||
if linkerOutputType != .staticLibrary && !sanitizers.isEmpty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keith do you, by any chance, remember why we had this restriction for .executable
?
!= .staticLibrary
seems like the right thing to do here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrm im not sure, maybe I got it from this /~https://github.com/apple/swift-driver/blob/7a96ffdd68dda2049cc2da005493b872ea43e3bc/Sources/SwiftDriver/Jobs/GenericUnixToolchain%2BLinkerSupport.swift#L272, I think you're right though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
besides previously there was a check for excluding the fuzzer sanitizer for executables, so you might want that back a557d59#diff-d44ec7a906797a39be2e42ecb334167ae217537ad09a726d1f905c4ba9130200L365
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Unless we are building a static library, we need to propagate
-fsanitizer=
flag to the clang linker driver, otherwise sanitizers libraries will not be found at link-time.Resolves rdar://107733898