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