misc: Further sanitise BIOS linker script

This commit is contained in:
mintsuki 2022-05-20 05:48:59 +02:00
parent 65c9ddaa6f
commit 4aed1aca9f
2 changed files with 6 additions and 77 deletions

View File

@ -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/*

View File

@ -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(*)
}
}