Share bss section with planschi section

This commit is contained in:
Jaby Blubb
2023-08-27 02:43:59 +02:00
parent 6ff067587d
commit 5c40ef119e
8 changed files with 87 additions and 84 deletions

View File

@@ -58,7 +58,7 @@ CCFLAGS += -DJABYENGINE_$(TV_FORMAT)
#Linker flags
LDFLAGS_release += -Os
LDFLAGS_all += -Wl,-Map=$(TARGET).map -nostdlib -T$(AUTO_OVERLAY_DIR)/Overlays.ld -T$(JABY_ENGINE_DIR)/lib/psexe.ld -static -Wl,--gc-sections -Wl,--build-id=none -Wl,--no-check-sections
LDFLAGS_all += -Wl,-Map=$(TARGET).map -nostdlib -T$(JABY_ENGINE_DIR)/lib/psexe.ld -static -Wl,--gc-sections -Wl,--build-id=none -Wl,--no-check-sections
LDFLAGS_all += $(ARCHFLAGS) -Wl,--oformat=$(FORMAT)
LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE))

View File

@@ -11,7 +11,7 @@ OVERLAY_TARGET = $(foreach ovl, $(OVERLAYSECTION), $(OUTPUT_DIR)/Overlay$(ovl))
#Linking rule
$(TARGET).elf: $(OBJS) $(JABY_ENGINE_LIB_DIR)/lib$(JABY_ENGINE_LIB_NAME).a $(AUTO_OVERLAY_DIR)/Overlays.ld
$(LD) -o $(TARGET).elf $(LDFLAGS_all) $(LDFLAGS) $(OBJS) -L$(JABY_ENGINE_LIB_DIR) -l$(JABY_ENGINE_LIB_NAME) $(LIBS)
$(LD) -o $(TARGET).elf $(LDFLAGS_all) $(LDFLAGS) $(OBJS) -L$(JABY_ENGINE_LIB_DIR) -L$(AUTO_OVERLAY_DIR) -l$(JABY_ENGINE_LIB_NAME) $(LIBS)
#Strips the psexe
$(TARGET).psexe: $(TARGET).elf

View File

@@ -25,7 +25,6 @@ SOFTWARE.
*/
OUTPUT_FORMAT("binary")
EXTERN(_ZN10JabyEngine5startEv)
ENTRY(_ZN10JabyEngine5startEv)
@@ -34,7 +33,6 @@ TLOAD_ADDR = DEFINED(TLOAD_ADDR) ? TLOAD_ADDR : 0x80010000;
MEMORY {
loader : ORIGIN = (TLOAD_ADDR - 0x800), LENGTH = 2048
ram (rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000
ram2 (rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000
dcache : ORIGIN = 0x1f800000, LENGTH = 0x400
}
@@ -62,38 +60,39 @@ SECTIONS {
}
/*Overlay sections created by mkoverlay*/
INCLUDE Overlays.ld
SECTIONS {
.planschi __bss_end : SUBALIGN(4)
.planschi __engine_bss_end : SUBALIGN(4)
{
__planschi_start = .;
__boot_loader_start = .;
*libJabyEngine.a:*_boot.o(.text.startup._GLOBAL__*)
*libJabyEngine_*.a:*_boot.o(.text.startup._GLOBAL__*)
*_boot.o(.text.startup._GLOBAL__*)
*libJabyEngine.a:*_boot.o(.ctors)
*libJabyEngine_*.a:*_boot.o(.ctors)
*_boot.o(.ctors)
*libJabyEngine.a:*_boot.o(.text.*)
*libJabyEngine_*.a:*_boot.o(.text.*)
*_boot.o(.text.*)
*libJabyEngine.a:*_boot.o(.rodata*)
*libJabyEngine_*.a:*_boot.o(.rodata*)
*_boot.o(.rodata*)
*libJabyEngine.a:*_boot.o(.sdata*)
*libJabyEngine_*.a:*_boot.o(.sdata*)
*_boot.o(.sdata*)
*libJabyEngine.a:*_boot.o(.data*)
*libJabyEngine_*.a:*_boot.o(.data*)
*_boot.o(.data*)
*libJabyEngine.a:*_boot.o(.sbss*)
*libJabyEngine_*.a:*_boot.o(.sbss*)
*_boot.o(.sbss*)
*libJabyEngine.a:*_boot.o(.bss*)
*libJabyEngine_*.a:*_boot.o(.bss*)
*_boot.o(.bss*)
*libJabyEngine.a:*_boot.o(*)
*libJabyEngine_*.a:*_boot.o(*)
*_boot.o(*)
. = ALIGN(4);
__boot_loader_end = .;
/*Only needed for the PSX BIOS to load the entire game*/
. = ALIGN(2048);
__planschi_end = .;
}
__planschi_end = .;
}
}
SECTIONS {
@@ -141,37 +140,36 @@ SECTIONS {
. = . + 1992;
} > loader
__persistent_lbas_start = ABSOLUTE(.);
.persistent_lbas TLOAD_ADDR : {
__persistent_lbas = .;
KEEP(*(.header.lbas))
__persistent_lbas_start = .;
__persistent_lbas = .;
KEEP(*(.header.lbas))
. = ALIGN(4);
__persistent_lbas_end = .;
} > ram
. = ALIGN(4);
__persistent_lbas_end = ABSOLUTE(.);
__ftext_start = ABSOLUTE(.);
.text : {
*(.start)
*(.init)
KEEP (*(SORT_NONE(.fini)))
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
__text_start = .;
*(.start)
*(.init)
KEEP (*(SORT_NONE(.fini)))
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
. = ALIGN(16);
KEEP(*(.init))
. = ALIGN(16);
KEEP(*(.fini))
. = ALIGN(16);
KEEP(*(.init))
. = ALIGN(16);
KEEP(*(.fini))
__text_end = .;
} > ram
. = ALIGN(16);
__text_end = .;
__ftext_end = ABSOLUTE(.);
__fdata_start = ABSOLUTE(.);
.rodata : {
*(.rodata .rodata.* .rdata .rdata.* .gnu.linkonce.r.*)
. = ALIGN(16);
@@ -210,33 +208,43 @@ SECTIONS {
*(.rodata1)
} > ram
__data_start = .;
.data : {
*(.a0table)
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
*(.sdata .sdata.* .gnu.linkonce.s.*)
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
*(.got.plt)
*(.got)
__data_start = .;
*(.a0table)
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
*(.sdata .sdata.* .gnu.linkonce.s.*)
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
*(.got.plt)
*(.got)
__data_end = .;
} > ram
__data_end = .;
.engine_bss : {
__engine_bss_start = .;
*libJabyEngine_*.a:*(.dynsbss)
*libJabyEngine_*.a:*(.sbss .sbss.* .gnu.linkonce.sb.*)
*libJabyEngine_*.a:*(.scommon)
*libJabyEngine_*.a:*(.dynbss)
*libJabyEngine_*.a:*(.bss .bss.* .gnu.linkonce.b.*)
*libJabyEngine_*.a:*(COMMON)
. = ALIGN(4);
__engine_bss_end = .;
} > ram
__fdata_end = .;
__bss_start = .;
.bss : {
.bss __persistent_overlay_end (NOLOAD) : {
__bss_start = .;
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
} > ram
. = ALIGN(4);
__bss_end = .;
__heap_start = __heap_base;
/*. = ADDR(.text) - 0x800;*/
__heap_start = __bss_end;
__end = .;
}
}