2021-03-25 18:38:09 +00:00
|
|
|
--- rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs.orig 2021-03-09 10:40:09.755485845 -0800
|
|
|
|
+++ rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs 2021-03-09 10:44:51.257426181 -0800
|
|
|
|
@@ -1279,11 +1279,13 @@
|
2020-08-27 17:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind {
|
|
|
|
- let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) {
|
|
|
|
+ // Only use PIE if explicity specified.
|
|
|
|
+ let explicit_pic = matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic));
|
|
|
|
+ let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) {
|
2021-03-25 18:38:09 +00:00
|
|
|
(CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe,
|
|
|
|
- (CrateType::Executable, false, RelocModel::Pic) => LinkOutputKind::DynamicPicExe,
|
2020-08-27 17:49:15 +00:00
|
|
|
+ (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe,
|
|
|
|
(CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe,
|
|
|
|
- (CrateType::Executable, true, RelocModel::Pic) => LinkOutputKind::StaticPicExe,
|
|
|
|
+ (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe,
|
|
|
|
(CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe,
|
|
|
|
(_, true, _) => LinkOutputKind::StaticDylib,
|
|
|
|
(_, false, _) => LinkOutputKind::DynamicDylib,
|