-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
x86_64-musl: allow building dylibs with -crt-static #38075
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,7 +237,16 @@ pub fn default_output_for_target(sess: &Session) -> config::CrateType { | |
/// Checks if target supports crate_type as output | ||
pub fn invalid_output_for_target(sess: &Session, | ||
crate_type: config::CrateType) -> bool { | ||
match (sess.target.target.options.dynamic_linking, | ||
let requested_features = sess.opts.cg.target_feature.split(','); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This addition duplicates part of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps this logic could get refactored to a method on |
||
let found_negative = requested_features.clone().any(|r| r == "-crt-static"); | ||
let found_positive = requested_features.clone().any(|r| r == "+crt-static"); | ||
let crt_static = if sess.target.target.options.crt_static_default { | ||
!found_negative | ||
} else { | ||
found_positive | ||
}; | ||
|
||
match (sess.target.target.options.dynamic_linking && !crt_static, | ||
sess.target.target.options.executables, crate_type) { | ||
(false, _, config::CrateTypeCdylib) | | ||
(false, _, config::CrateTypeProcMacro) | | ||
|
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.
Hm I wonder if this logic is insufficient now? Presumably we should pass
-pie
for dynamically linked musl executables?