:: commit 88e1b1fa8b4f8ce8d58f9ada42cac1d46a79db1c

Mintsuki <mintsuki@protonmail.com> — 2025-07-23 23:37

parents: e05e09072f

build: Explicitly break ld.gold

ld.gold has sadly bitrotted and cannot reliably be used to link Limine.
diff --git a/common/common.mk b/common/common.mk
index 5fb5dca4..3a3e9836 100644
--- a/common/common.mk
+++ b/common/common.mk
@@ -185,21 +185,27 @@ endif
 ifeq ($(TARGET),uefi-x86-64)
     override LDFLAGS_FOR_TARGET += \
         -m elf_x86_64 \
+        -static \
         -pie \
+        --no-dynamic-linker \
         -z text
 endif
 
 ifeq ($(TARGET),uefi-ia32)
     override LDFLAGS_FOR_TARGET += \
         -m elf_i386 \
+        -static \
         -pie \
+        --no-dynamic-linker \
         -z text
 endif
 
 ifeq ($(TARGET),uefi-aarch64)
     override LDFLAGS_FOR_TARGET += \
         -m aarch64elf \
+        -static \
         -pie \
+        --no-dynamic-linker \
         -z text
 endif
 
@@ -207,7 +213,9 @@ ifeq ($(TARGET),uefi-riscv64)
     override LDFLAGS_FOR_TARGET += \
         -m elf64lriscv \
         --no-relax \
+        -static \
         -pie \
+        --no-dynamic-linker \
         -z text
 endif
 
@@ -215,7 +223,9 @@ ifeq ($(TARGET),uefi-loongarch64)
     override LDFLAGS_FOR_TARGET += \
         -m elf64loongarch \
         --no-relax \
+        -static \
         -pie \
+        --no-dynamic-linker \
         -z text
 endif
 
diff --git a/common/linker_bios.ld.in b/common/linker_bios.ld.in
index 4c90b986..85026566 100644
--- a/common/linker_bios.ld.in
+++ b/common/linker_bios.ld.in
@@ -3,12 +3,12 @@ ENTRY(_start)
 
 PHDRS
 {
-    text_s2   PT_LOAD    FLAGS(0x05);
-    rodata_s2 PT_LOAD    FLAGS(0x04);
-    data_s2   PT_LOAD    FLAGS(0x06);
-    text_s3   PT_LOAD    FLAGS(0x05);
-    rodata_s3 PT_LOAD    FLAGS(0x04);
-    data_s3   PT_LOAD    FLAGS(0x06);
+    text_s2   PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    rodata_s2 PT_LOAD    FLAGS((1 << 2)) ;
+    data_s2   PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
+    text_s3   PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    rodata_s3 PT_LOAD    FLAGS((1 << 2)) ;
+    data_s3   PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
 }
 
 SECTIONS
diff --git a/common/linker_uefi_aarch64.ld.in b/common/linker_uefi_aarch64.ld.in
index e6bcb2ab..f5d1f886 100644
--- a/common/linker_uefi_aarch64.ld.in
+++ b/common/linker_uefi_aarch64.ld.in
@@ -3,10 +3,10 @@ ENTRY(_start)
 
 PHDRS
 {
-    text    PT_LOAD    FLAGS(0x05);
-    rodata  PT_LOAD    FLAGS(0x04);
-    data    PT_LOAD    FLAGS(0x06);
-    dynamic PT_DYNAMIC FLAGS(0x06);
+    text    PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    rodata  PT_LOAD    FLAGS((1 << 2)) ;
+    data    PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
+    dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ;
 }
 
 SECTIONS
diff --git a/common/linker_uefi_ia32.ld.in b/common/linker_uefi_ia32.ld.in
index a1133359..f7b37c73 100644
--- a/common/linker_uefi_ia32.ld.in
+++ b/common/linker_uefi_ia32.ld.in
@@ -3,10 +3,10 @@ ENTRY(_start)
 
 PHDRS
 {
-    text    PT_LOAD    FLAGS(0x05);
-    rodata  PT_LOAD    FLAGS(0x04);
-    data    PT_LOAD    FLAGS(0x06);
-    dynamic PT_DYNAMIC FLAGS(0x06);
+    text    PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    rodata  PT_LOAD    FLAGS((1 << 2)) ;
+    data    PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
+    dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ;
 }
 
 SECTIONS
diff --git a/common/linker_uefi_riscv64.ld.in b/common/linker_uefi_riscv64.ld.in
index 55f2a9c6..f9894cfa 100644
--- a/common/linker_uefi_riscv64.ld.in
+++ b/common/linker_uefi_riscv64.ld.in
@@ -3,10 +3,10 @@ ENTRY(_start)
 
 PHDRS
 {
-    text    PT_LOAD    FLAGS(0x05);
-    rodata  PT_LOAD    FLAGS(0x04);
-    data    PT_LOAD    FLAGS(0x06);
-    dynamic PT_DYNAMIC FLAGS(0x06);
+    text    PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    rodata  PT_LOAD    FLAGS((1 << 2)) ;
+    data    PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
+    dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ;
 }
 
 SECTIONS
diff --git a/common/linker_uefi_x86_64.ld.in b/common/linker_uefi_x86_64.ld.in
index 0176a510..ead64518 100644
--- a/common/linker_uefi_x86_64.ld.in
+++ b/common/linker_uefi_x86_64.ld.in
@@ -3,10 +3,10 @@ ENTRY(_start)
 
 PHDRS
 {
-    text    PT_LOAD    FLAGS(0x05);
-    rodata  PT_LOAD    FLAGS(0x04);
-    data    PT_LOAD    FLAGS(0x06);
-    dynamic PT_DYNAMIC FLAGS(0x06);
+    text    PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    rodata  PT_LOAD    FLAGS((1 << 2)) ;
+    data    PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
+    dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ;
 }
 
 SECTIONS
diff --git a/decompressor/linker.ld b/decompressor/linker.ld
index c6adcfac..5dfa18e7 100644
--- a/decompressor/linker.ld
+++ b/decompressor/linker.ld
@@ -3,9 +3,9 @@ ENTRY(_start)
 
 PHDRS
 {
-    text  PT_LOAD    FLAGS(0x05);
-    rodata PT_LOAD   FLAGS(0x04);
-    data  PT_LOAD    FLAGS(0x06);
+    text  PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    rodata PT_LOAD   FLAGS((1 << 2)) ;
+    data  PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
 }
 
 SECTIONS
tab: 248 wrap: offon