2e0a74
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
2e0a74
index 638b2a7b5a9f..79d4ecf4cb91 100644
2e0a74
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
2e0a74
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
2e0a74
@@ -763,7 +763,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
2e0a74
             && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie")
2e0a74
         {
2e0a74
             info!("linker output: {:?}", out);
2e0a74
-            warn!("Linker does not support -no-pie command line option. Retrying without.");
2e0a74
+            info!("Linker does not support -no-pie command line option. Retrying without.");
2e0a74
             for arg in cmd.take_args() {
2e0a74
                 if arg.to_string_lossy() != "-no-pie" {
2e0a74
                     cmd.arg(arg);
2e0a74
@@ -782,7 +782,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
2e0a74
             && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie")
2e0a74
         {
2e0a74
             info!("linker output: {:?}", out);
2e0a74
-            warn!(
2e0a74
+            info!(
2e0a74
                 "Linker does not support -static-pie command line option. Retrying with -static instead."
2e0a74
             );
2e0a74
             // Mirror `add_(pre,post)_link_objects` to replace CRT objects.
2e0a74
@@ -1507,15 +1507,14 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2e0a74
 }
2e0a74
 
2e0a74
 fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind {
2e0a74
-    let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) {
2e0a74
+    // Only use PIE if explicitly specified.
2e0a74
+    let explicit_pic =
2e0a74
+        matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie));
2e0a74
+    let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) {
2e0a74
         (CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe,
2e0a74
-        (CrateType::Executable, false, RelocModel::Pic | RelocModel::Pie) => {
2e0a74
-            LinkOutputKind::DynamicPicExe
2e0a74
-        }
2e0a74
+        (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe,
2e0a74
         (CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe,
2e0a74
-        (CrateType::Executable, true, RelocModel::Pic | RelocModel::Pie) => {
2e0a74
-            LinkOutputKind::StaticPicExe
2e0a74
-        }
2e0a74
+        (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe,
2e0a74
         (CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe,
2e0a74
         (_, true, _) => LinkOutputKind::StaticDylib,
2e0a74
         (_, false, _) => LinkOutputKind::DynamicDylib,