2021-12-02 23:05:01 +00:00
|
|
|
--- rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs.orig 2021-11-29 10:41:02.380100917 -0800
|
|
|
|
+++ rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs 2021-11-29 10:53:31.014783112 -0800
|
|
|
|
@@ -1485,15 +1485,14 @@
|
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.
|
2021-12-02 23:05:01 +00:00
|
|
|
+ let explicit_pic =
|
|
|
|
+ matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie));
|
2020-08-27 17:49:15 +00:00
|
|
|
+ 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,
|
2021-12-02 23:05:01 +00:00
|
|
|
- (CrateType::Executable, false, RelocModel::Pic | RelocModel::Pie) => {
|
|
|
|
- LinkOutputKind::DynamicPicExe
|
|
|
|
- }
|
2020-08-27 17:49:15 +00:00
|
|
|
+ (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe,
|
|
|
|
(CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe,
|
2021-12-02 23:05:01 +00:00
|
|
|
- (CrateType::Executable, true, RelocModel::Pic | RelocModel::Pie) => {
|
|
|
|
- LinkOutputKind::StaticPicExe
|
|
|
|
- }
|
2020-08-27 17:49:15 +00:00
|
|
|
+ (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe,
|
|
|
|
(CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe,
|
|
|
|
(_, true, _) => LinkOutputKind::StaticDylib,
|
|
|
|
(_, false, _) => LinkOutputKind::DynamicDylib,
|