From 65c9ddaa6f9b331d622f12d5d6cbcae7ee688190 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Fri, 20 May 2022 05:17:46 +0200 Subject: [PATCH] misc: BIOS linker script fixes for LLD --- common/GNUmakefile | 2 +- common/linker_bios.ld.in | 27 ++++++++------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/common/GNUmakefile b/common/GNUmakefile index 3b27196d..22d24132 100644 --- a/common/GNUmakefile +++ b/common/GNUmakefile @@ -215,7 +215,7 @@ $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz: $(call MKESCAPE,$(BUILDDIR))/stage2. gzip -n -9 < '$(call SHESCAPE,$<)' > '$(call SHESCAPE,$@)' $(call MKESCAPE,$(BUILDDIR))/stage2.bin: $(call MKESCAPE,$(BUILDDIR))/limine.sys - dd if='$(call SHESCAPE,$<)' bs=$$(( 0x$$("$(LIMINE_READELF)" -S '$(call SHESCAPE,$(BUILDDIR))/limine.elf' | $(GREP) .stage3.text | $(SED) 's/^.*] //' | $(AWK) '{print $$3}' | $(SED) 's/^0*//') - 0x8000 )) count=1 of='$(call SHESCAPE,$@)' 2>/dev/null + dd if='$(call SHESCAPE,$<)' bs=$$(( 0x$$("$(LIMINE_READELF)" -S '$(call SHESCAPE,$(BUILDDIR))/limine.elf' | $(GREP) .text.stage3 | $(SED) 's/^.*] //' | $(AWK) '{print $$3}' | $(SED) 's/^0*//') - 0x8000 )) count=1 of='$(call SHESCAPE,$@)' 2>/dev/null $(call MKESCAPE,$(BUILDDIR))/stage2.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_stage2only.elf cd '$(call SHESCAPE,$(BUILDDIR))' && \ diff --git a/common/linker_bios.ld.in b/common/linker_bios.ld.in index 46f47643..3583e0e4 100644 --- a/common/linker_bios.ld.in +++ b/common/linker_bios.ld.in @@ -15,24 +15,16 @@ SECTIONS { . = 0x8000; - .entry : { + .text.stage2 : { *(.entry) - } :text_s2 - - .realmode : { *(.realmode) - } :text_s2 - - .stage2.text : { *.s2.o(.text .text.*) } :text_s2 - .stage2.build-id : { + .data.stage2 : { build_id_s2 = .; *build-id.s2.o(*) - } :data_s2 - .stage2.data : { *.s2.o(.no_unwind) s2_data_begin = .; *.s2.o(.data .data.*) @@ -59,17 +51,15 @@ SECTIONS } :data_s2 #ifndef LINKER_STAGE2ONLY - .stage3.text : { + .text.stage3 : { stage3_addr = .; *(.text .text.*) } :text_s3 - .stage3.build-id : { + .data.stage3 : { build_id_s3 = .; *build-id.s3.o(*) - } :data_s3 - .stage3.data : { *(.rodata .rodata.*) #ifdef LINKER_NOMAP full_map = .; @@ -82,7 +72,10 @@ SECTIONS } :data_s3 #endif - limine_sys_size = . - 0x8000; + .note.gnu.build-id : { + *(.note.gnu.build-id) + limine_sys_size = . - 0x8000; + } :data_s3 .bss : { bss_begin = .; @@ -92,10 +85,6 @@ SECTIONS data_end = .; } :data_s3 - .note.gnu.build-id 0 : { - *(.note.gnu.build-id) - } :null - .symtab 0 : { *(.symtab) } :null