:: commit 4aed1aca9f7c070c43c1a49379d899d22f925fbd

mintsuki <mintsuki@protonmail.com> — 2022-05-20 03:48

parents: 65c9ddaa6f

misc: Further sanitise BIOS linker script

diff --git a/common/GNUmakefile b/common/GNUmakefile
index 22d24132..472daaea 100644
--- a/common/GNUmakefile
+++ b/common/GNUmakefile
@@ -175,7 +175,7 @@ endif
 override HEADER_DEPS := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.d))
 
 ifeq ($(TARGET), bios)
-all: $(call MKESCAPE,$(BUILDDIR))/limine_dbg.elf $(call MKESCAPE,$(BUILDDIR))/limine.sys $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz
+all: $(call MKESCAPE,$(BUILDDIR))/limine.sys $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz
 else ifeq ($(TARGET), uefi64)
 all: $(call MKESCAPE,$(BUILDDIR))/BOOTX64.EFI
 else ifeq ($(TARGET), uefi32)
@@ -265,14 +265,6 @@ $(call MKESCAPE,$(BUILDDIR))/limine.elf: $(OBJ) $(call MKESCAPE,$(BUILDDIR))/tin
 		$(LIMINE_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) build-id.s3.bin build-id.s3.o
 	$(LIMINE_LD) '$(call SHESCAPE,$(BUILDDIR))/build-id.s2.o' '$(call SHESCAPE,$(BUILDDIR))/build-id.s3.o' '$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' -o '$(call SHESCAPE,$@)'
 
-$(call MKESCAPE,$(BUILDDIR))/linker_dbg.ld: linker_bios.ld.in
-	mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
-	$(LIMINE_CC) -x c -E -P -undef -DLINKER_DBG linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_dbg.ld'
-
-$(call MKESCAPE,$(BUILDDIR))/limine_dbg.elf: $(OBJ) $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o $(call MKESCAPE,$(BUILDDIR))/stage2.map.o $(call MKESCAPE,$(BUILDDIR))/full.map.o
-	$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker_dbg.ld'
-	$(LIMINE_LD) '$(call OBJESCAPE,$^)' $(LIMINE_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_dbg.ld' -o '$(call SHESCAPE,$@)'
-
 endif
 
 $(call MKESCAPE,$(BUILDDIR))/reduced-gnu-efi: ../reduced-gnu-efi/*
diff --git a/common/linker_bios.ld.in b/common/linker_bios.ld.in
index 3583e0e4..e1b047a3 100644
--- a/common/linker_bios.ld.in
+++ b/common/linker_bios.ld.in
@@ -4,11 +4,10 @@ ENTRY(_start)
 
 PHDRS
 {
-    null    PT_NULL    FLAGS(0) ;
-    text_s2 PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
-    data_s2 PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
-    text_s3 PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
-    data_s3 PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
+    text_s2   PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    data_s2   PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
+    text_s3   PT_LOAD    FLAGS((1 << 0) | (1 << 2)) ;
+    data_s3   PT_LOAD    FLAGS((1 << 1) | (1 << 2)) ;
 }
 
 SECTIONS
@@ -85,69 +84,7 @@ SECTIONS
         data_end = .;
     } :data_s3
 
-    .symtab 0 : {
-        *(.symtab)
-    } :null
-
-    .strtab 0 : {
-        *(.strtab)
-    } :null
-
-    .shstrtab 0 : {
-        *(.shstrtab)
-    } :null
-
-#ifdef LINKER_DBG
-    .debug_aranges 0 : {
-        *(.debug_aranges)
-    } :null
-
-    .debug_pubnames 0 : {
-        *(.debug_pubnames)
-    } :null
-
-    .debug_info 0 : {
-        *(.debug_info)
-    } :null
-
-    .debug_abbrev 0 : {
-        *(.debug_abbrev)
-    } :null
-
-    .debug_line 0 : {
-        *(.debug_line)
-    } :null
-
-    .debug_loclists 0 : {
-        *(.debug_loclists)
-    } :null
-
-    .debug_rnglists 0 : {
-        *(.debug_rnglists)
-    } :null
-
-    .debug_frame 0 : {
-        *(.debug_frame)
-    } :null
-
-    .debug_loc 0 : {
-        *(.debug_loc)
-    } :null
-
-    .debug_ranges 0 : {
-        *(.debug_ranges)
-    } :null
-
-    .debug_str 0 : {
-        *(.debug_str)
-    } :null
-
-    .debug_line_str 0 : {
-        *(.debug_line_str)
-    } :null
-#endif
-
     /DISCARD/ : {
-        *(*)
+        *.o(*)
     }
 }
tab: 248 wrap: offon