Disable auto crlf
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
#Add the JabyEngine tools to path
|
||||
#Add the JabyEngine tools to path
|
||||
export PATH := $(JABY_ENGINE_DIR)/bin/:$(PATH)
|
@@ -1,13 +1,13 @@
|
||||
CD_OUTPUT ?= $(ARTIFACT).bin
|
||||
|
||||
$(CD_OUTPUT): always
|
||||
psxcdgen_ex --list $(ARTIFACT).lba -o $(ARTIFACT) psx bin-cue Config.xml
|
||||
|
||||
all: $(CD_OUTPUT)
|
||||
|
||||
clean:
|
||||
rm -fr *.bin
|
||||
rm -fr *.cue
|
||||
rm -fr *.lba
|
||||
|
||||
CD_OUTPUT ?= $(ARTIFACT).bin
|
||||
|
||||
$(CD_OUTPUT): always
|
||||
psxcdgen_ex --list $(ARTIFACT).lba -o $(ARTIFACT) psx bin-cue Config.xml
|
||||
|
||||
all: $(CD_OUTPUT)
|
||||
|
||||
clean:
|
||||
rm -fr *.bin
|
||||
rm -fr *.cue
|
||||
rm -fr *.lba
|
||||
|
||||
always: ;
|
194
mkfile/Makefile
194
mkfile/Makefile
@@ -1,98 +1,98 @@
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
include $(SELF_DIR)ExportPath.mk
|
||||
|
||||
substitute = $(subst $(JABY_ENGINE_DIR)/include/modules,!JABYENGINEMODULES,$(subst ..,!super,$1))
|
||||
desubstitute = $(subst !JABYENGINEMODULES,$(JABY_ENGINE_DIR)/include/modules,$(subst !super,..,$1))
|
||||
|
||||
#Build architecture/variant string, possible values: x86, armv7le, etc...
|
||||
PLATFORM ?= PSX
|
||||
|
||||
#Build profile, possible values: release, debug, profile, coverage
|
||||
BUILD_DIR ?= bin
|
||||
BUILD_PROFILE ?= debug
|
||||
TV_FORMAT ?= PAL
|
||||
|
||||
CONFIG_NAME ?= $(PLATFORM)-$(BUILD_PROFILE)
|
||||
OUTPUT_DIR = $(BUILD_DIR)/$(CONFIG_NAME)
|
||||
TARGET = $(OUTPUT_DIR)/$(ARTIFACT)
|
||||
|
||||
#Compiler definitions
|
||||
HAS_LINUX_MIPS_GCC = $(shell which mipsel-linux-gnu-gcc > /dev/null 2> /dev/null && echo true || echo false)
|
||||
ifeq ($(HAS_LINUX_MIPS_GCC),true)
|
||||
PREFIX ?= mipsel-linux-gnu
|
||||
FORMAT ?= elf32-tradlittlemips
|
||||
else
|
||||
PREFIX ?= mipsel-none-elf
|
||||
FORMAT ?= elf32-littlemips
|
||||
endif
|
||||
|
||||
#Take this to PSEXETarget.mk??
|
||||
#LDSCRIPT ?= $(PSCX_REDUX_DIR)/ps-exe.ld
|
||||
#ifneq ($(strip $(OVERLAYSCRIPT)),)
|
||||
#LDSCRIPT := $(addprefix $(OVERLAYSCRIPT) , -T$(LDSCRIPT))
|
||||
#else
|
||||
#LDSCRIPT := $(addprefix $(PSCX_REDUX_DIR)/default.ld , -T$(LDSCRIPT))
|
||||
#endif
|
||||
|
||||
CC = $(PREFIX)-gcc
|
||||
CXX = $(PREFIX)-g++
|
||||
LD = $(CXX)
|
||||
AR = ar
|
||||
|
||||
#architecture flags
|
||||
ARCHFLAGS = -march=r2000 -mtune=r2000 -mabi=32 -EL -fno-pic -mno-shared -nostdinc -nostdinc++ -mno-abicalls -mfp32 -mno-llsc
|
||||
ARCHFLAGS += -fno-stack-protector -nostdlib -ffreestanding
|
||||
|
||||
#Compiler flags for build profiles
|
||||
CCFLAGS_release += -O3
|
||||
CCFLAGS_debug += -O0
|
||||
|
||||
CXXFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
CCFLAGS += -mno-gpopt -fomit-frame-pointer -ffunction-sections -fdata-sections
|
||||
CCFLAGS += -fno-builtin -fno-strict-aliasing -Wno-attributes
|
||||
CCFLAGS += -std=c++20 -fmodules-ts
|
||||
CCFLAGS += $(CCFLAGS_$(BUILD_PROFILE))
|
||||
CCFLAGS += $(ARCHFLAGS)
|
||||
CCFLAGS += $(INCLUDES)
|
||||
CCFLAGS += -DJABYENGINE_$(TV_FORMAT)
|
||||
|
||||
#Linker flags
|
||||
LDFLAGS_release += -Os
|
||||
|
||||
LDFLAGS_all += -Wl,-Map=$(TARGET).map -nostdlib -T$(JABY_ENGINE_DIR)/mkfile/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))
|
||||
|
||||
LIBS_all += $(LIBS_$(BUILD_PROFILE))
|
||||
|
||||
DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@
|
||||
|
||||
#Object files list
|
||||
MODS += $(call rwildcard,$(JABY_ENGINE_DIR)/include/modules, cxx)
|
||||
SRCS := $(MODS) $(SRCS)
|
||||
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(call substitute,$(basename $(SRCS)))))
|
||||
|
||||
#Compiling rule
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.s)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -c $(DEPS) -o $@ $(CCFLAGS) $<
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.c)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -c $(DEPS) -o $@ $(CCFLAGS) $<
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.cpp)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS) $(CXXFLAGS) $<
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.cxx)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS) $(CXXFLAGS) $<
|
||||
|
||||
#Inclusion of dependencies (object files to source and includes)
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
include $(SELF_DIR)ExportPath.mk
|
||||
|
||||
substitute = $(subst $(JABY_ENGINE_DIR)/include/modules,!JABYENGINEMODULES,$(subst ..,!super,$1))
|
||||
desubstitute = $(subst !JABYENGINEMODULES,$(JABY_ENGINE_DIR)/include/modules,$(subst !super,..,$1))
|
||||
|
||||
#Build architecture/variant string, possible values: x86, armv7le, etc...
|
||||
PLATFORM ?= PSX
|
||||
|
||||
#Build profile, possible values: release, debug, profile, coverage
|
||||
BUILD_DIR ?= bin
|
||||
BUILD_PROFILE ?= debug
|
||||
TV_FORMAT ?= PAL
|
||||
|
||||
CONFIG_NAME ?= $(PLATFORM)-$(BUILD_PROFILE)
|
||||
OUTPUT_DIR = $(BUILD_DIR)/$(CONFIG_NAME)
|
||||
TARGET = $(OUTPUT_DIR)/$(ARTIFACT)
|
||||
|
||||
#Compiler definitions
|
||||
HAS_LINUX_MIPS_GCC = $(shell which mipsel-linux-gnu-gcc > /dev/null 2> /dev/null && echo true || echo false)
|
||||
ifeq ($(HAS_LINUX_MIPS_GCC),true)
|
||||
PREFIX ?= mipsel-linux-gnu
|
||||
FORMAT ?= elf32-tradlittlemips
|
||||
else
|
||||
PREFIX ?= mipsel-none-elf
|
||||
FORMAT ?= elf32-littlemips
|
||||
endif
|
||||
|
||||
#Take this to PSEXETarget.mk??
|
||||
#LDSCRIPT ?= $(PSCX_REDUX_DIR)/ps-exe.ld
|
||||
#ifneq ($(strip $(OVERLAYSCRIPT)),)
|
||||
#LDSCRIPT := $(addprefix $(OVERLAYSCRIPT) , -T$(LDSCRIPT))
|
||||
#else
|
||||
#LDSCRIPT := $(addprefix $(PSCX_REDUX_DIR)/default.ld , -T$(LDSCRIPT))
|
||||
#endif
|
||||
|
||||
CC = $(PREFIX)-gcc
|
||||
CXX = $(PREFIX)-g++
|
||||
LD = $(CXX)
|
||||
AR = ar
|
||||
|
||||
#architecture flags
|
||||
ARCHFLAGS = -march=r2000 -mtune=r2000 -mabi=32 -EL -fno-pic -mno-shared -nostdinc -nostdinc++ -mno-abicalls -mfp32 -mno-llsc
|
||||
ARCHFLAGS += -fno-stack-protector -nostdlib -ffreestanding
|
||||
|
||||
#Compiler flags for build profiles
|
||||
CCFLAGS_release += -O3
|
||||
CCFLAGS_debug += -O0
|
||||
|
||||
CXXFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
CCFLAGS += -mno-gpopt -fomit-frame-pointer -ffunction-sections -fdata-sections
|
||||
CCFLAGS += -fno-builtin -fno-strict-aliasing -Wno-attributes
|
||||
CCFLAGS += -std=c++20 -fmodules-ts
|
||||
CCFLAGS += $(CCFLAGS_$(BUILD_PROFILE))
|
||||
CCFLAGS += $(ARCHFLAGS)
|
||||
CCFLAGS += $(INCLUDES)
|
||||
CCFLAGS += -DJABYENGINE_$(TV_FORMAT)
|
||||
|
||||
#Linker flags
|
||||
LDFLAGS_release += -Os
|
||||
|
||||
LDFLAGS_all += -Wl,-Map=$(TARGET).map -nostdlib -T$(JABY_ENGINE_DIR)/mkfile/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))
|
||||
|
||||
LIBS_all += $(LIBS_$(BUILD_PROFILE))
|
||||
|
||||
DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@
|
||||
|
||||
#Object files list
|
||||
MODS += $(call rwildcard,$(JABY_ENGINE_DIR)/include/modules, cxx)
|
||||
SRCS := $(MODS) $(SRCS)
|
||||
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(call substitute,$(basename $(SRCS)))))
|
||||
|
||||
#Compiling rule
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.s)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -c $(DEPS) -o $@ $(CCFLAGS) $<
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.c)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -c $(DEPS) -o $@ $(CCFLAGS) $<
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.cpp)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS) $(CXXFLAGS) $<
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.cxx)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS) $(CXXFLAGS) $<
|
||||
|
||||
#Inclusion of dependencies (object files to source and includes)
|
||||
-include $(OBJS:%.o=%.d)
|
@@ -1,37 +1,37 @@
|
||||
#Not intended to be overriden
|
||||
AUTO_OVERLAY_DIR = $(OUTPUT_DIR)/auto_overlay
|
||||
|
||||
include $(AUTO_OVERLAY_DIR)/Overlays.mk
|
||||
|
||||
#We use the JabyEngine so we will include ourselves
|
||||
JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE)
|
||||
JABY_ENGINE_LIB_NAME = JabyEngine_$(TV_FORMAT)
|
||||
|
||||
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$(AUTO_OVERLAY_DIR) -l$(JABY_ENGINE_LIB_NAME) $(LIBS)
|
||||
|
||||
#Strips the psexe
|
||||
$(TARGET).psexe: $(TARGET).elf
|
||||
$(PREFIX)-objcopy $(addprefix -R , $(OVERLAYSECTION)) -O binary $< $@
|
||||
|
||||
#Create overlays
|
||||
$(OVERLAY_TARGET): $(TARGET).elf
|
||||
$(PREFIX)-objcopy -j $(suffix $@) -O binary $< $@
|
||||
|
||||
#Create overlay makefile
|
||||
$(AUTO_OVERLAY_DIR)/Overlays.mk: $(OVERLAY_CONFIG)
|
||||
@mkdir -p $(AUTO_OVERLAY_DIR)
|
||||
mkoverlay --mk-file $(AUTO_OVERLAY_DIR)/Overlays.mk --ld-script $(AUTO_OVERLAY_DIR)/Overlays.ld $<
|
||||
|
||||
#Rules section for default compilation and linking
|
||||
all: $(TARGET).psexe $(OVERLAY_TARGET)
|
||||
|
||||
clean:
|
||||
rm -fr $(OUTPUT_DIR)
|
||||
|
||||
# For mkoverlay to function correctly this is required (otherwise Overlays.mk is not re-generated)
|
||||
rebuild: clean
|
||||
$(MAKE) all
|
||||
#Not intended to be overriden
|
||||
AUTO_OVERLAY_DIR = $(OUTPUT_DIR)/auto_overlay
|
||||
|
||||
include $(AUTO_OVERLAY_DIR)/Overlays.mk
|
||||
|
||||
#We use the JabyEngine so we will include ourselves
|
||||
JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE)
|
||||
JABY_ENGINE_LIB_NAME = JabyEngine_$(TV_FORMAT)
|
||||
|
||||
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$(AUTO_OVERLAY_DIR) -l$(JABY_ENGINE_LIB_NAME) $(LIBS)
|
||||
|
||||
#Strips the psexe
|
||||
$(TARGET).psexe: $(TARGET).elf
|
||||
$(PREFIX)-objcopy $(addprefix -R , $(OVERLAYSECTION)) -O binary $< $@
|
||||
|
||||
#Create overlays
|
||||
$(OVERLAY_TARGET): $(TARGET).elf
|
||||
$(PREFIX)-objcopy -j $(suffix $@) -O binary $< $@
|
||||
|
||||
#Create overlay makefile
|
||||
$(AUTO_OVERLAY_DIR)/Overlays.mk: $(OVERLAY_CONFIG)
|
||||
@mkdir -p $(AUTO_OVERLAY_DIR)
|
||||
mkoverlay --mk-file $(AUTO_OVERLAY_DIR)/Overlays.mk --ld-script $(AUTO_OVERLAY_DIR)/Overlays.ld $<
|
||||
|
||||
#Rules section for default compilation and linking
|
||||
all: $(TARGET).psexe $(OVERLAY_TARGET)
|
||||
|
||||
clean:
|
||||
rm -fr $(OUTPUT_DIR)
|
||||
|
||||
# For mkoverlay to function correctly this is required (otherwise Overlays.mk is not re-generated)
|
||||
rebuild: clean
|
||||
$(MAKE) all
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp
|
||||
#Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp
|
||||
rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))
|
500
mkfile/psexe.ld
500
mkfile/psexe.ld
@@ -1,251 +1,251 @@
|
||||
/*
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 PCSX-Redux authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("binary")
|
||||
EXTERN(_ZN10JabyEngine5startEv)
|
||||
ENTRY(_ZN10JabyEngine5startEv)
|
||||
|
||||
TLOAD_ADDR = DEFINED(TLOAD_ADDR) ? TLOAD_ADDR : 0x80010000;
|
||||
|
||||
MEMORY {
|
||||
loader : ORIGIN = (TLOAD_ADDR - 0x800), LENGTH = 2048
|
||||
ram(rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000
|
||||
ram_alt(rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000
|
||||
dcache : ORIGIN = 0x1f800000, LENGTH = 0x400
|
||||
}
|
||||
|
||||
__ram_top = ORIGIN(ram) + LENGTH(ram);
|
||||
__sp = __ram_top - 0x100;
|
||||
|
||||
__dcache = ORIGIN(dcache);
|
||||
__dcache_top = ORIGIN(dcache) + LENGTH(dcache);
|
||||
|
||||
__bss_len = (__bss_end - __bss_start);
|
||||
__ftext_len = (__ftext_end - __ftext_start);
|
||||
__fdata_len = (__planschi_end - __fdata_start);
|
||||
__persistent_lbas_len = (__persistent_lbas_end - __persistent_lbas_start);
|
||||
|
||||
__stack_start = ORIGIN(ram) + LENGTH(ram);
|
||||
|
||||
SECTIONS {
|
||||
/DISCARD/ : { *(.MIPS.abiflags) }
|
||||
|
||||
/* Everything is statically linked, so discard PLTs. */
|
||||
/DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) }
|
||||
|
||||
/* Discard things that the standard link script drops, too. */
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu.*) *(.comment) }
|
||||
}
|
||||
|
||||
/*Overlay sections created by mkoverlay*/
|
||||
INCLUDE Overlays.ld
|
||||
SECTIONS {
|
||||
.planschi __engine_bss_end : SUBALIGN(4)
|
||||
{
|
||||
__planschi_start = .;
|
||||
__boot_loader_start = .;
|
||||
|
||||
*libJabyEngine_*.a:*_boot.o(.text.startup._GLOBAL__*)
|
||||
*_boot.o(.text.startup._GLOBAL__*)
|
||||
*libJabyEngine_*.a:*_boot.o(.ctors)
|
||||
*_boot.o(.ctors)
|
||||
|
||||
*libJabyEngine_*.a:*_boot.o(.text.*)
|
||||
*_boot.o(.text.*)
|
||||
*libJabyEngine_*.a:*_boot.o(.rodata*)
|
||||
*_boot.o(.rodata*)
|
||||
*libJabyEngine_*.a:*_boot.o(.sdata*)
|
||||
*_boot.o(.sdata*)
|
||||
*libJabyEngine_*.a:*_boot.o(.data*)
|
||||
*_boot.o(.data*)
|
||||
*libJabyEngine_*.a:*_boot.o(.sbss*)
|
||||
*_boot.o(.sbss*)
|
||||
*libJabyEngine_*.a:*_boot.o(.bss*)
|
||||
*_boot.o(.bss*)
|
||||
*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 = .;
|
||||
} > ram_alt
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
.PSX_EXE_Header : {
|
||||
/*
|
||||
0x0000 - 0x0007 : "PS-X EXE"
|
||||
*/
|
||||
BYTE(80); BYTE(83); BYTE(45); BYTE(88); BYTE(32); BYTE(69); BYTE(88); BYTE(69);
|
||||
|
||||
/* 0x0008 - 0x000F : skip text_off and data_off since they're not supported by the PS1 BIOS */
|
||||
LONG(0); LONG(0);
|
||||
|
||||
/* 0x0010 - 0x0013 : entry point */
|
||||
LONG(ABSOLUTE(_ZN10JabyEngine5startEv));
|
||||
|
||||
/* 0x0014 - 0x0017 : initial value of $gp */
|
||||
LONG(0);
|
||||
|
||||
/* 0x0018 - 0x001B : Memory address to load "text" section to. */
|
||||
/*
|
||||
NOTE: The "text" section is actually all of the "load"
|
||||
sections of the file including .text, .rodata, .data.
|
||||
etc.
|
||||
*/
|
||||
LONG(TLOAD_ADDR);
|
||||
|
||||
/* 0x001C - 0x001F : size, in bytes, of the "text" section. */
|
||||
LONG(__persistent_lbas_len + __ftext_len + __fdata_len);
|
||||
|
||||
/* 0x0020 - 0x002F :
|
||||
Skip "data_addr", "data_size", "bss_addr" and "bss_size".
|
||||
None of these are supported by retail PS1 BIOS.
|
||||
*/
|
||||
LONG(0); LONG(0);
|
||||
LONG(0); LONG(0);
|
||||
|
||||
/* 0x0030 - 0x0033 : Initial stack address. */
|
||||
LONG(DEFINED(_sp) ? ABSOLUTE(_sp) : 0x801FFF00);
|
||||
|
||||
/* 0x0034 - 0x0037 : Initial stack size, set it to 0. */
|
||||
LONG(0);
|
||||
|
||||
/* Skip the remaining fields as they're not supported by the BIOS */
|
||||
/* e.g. 2048 header bytes minus whatever we've actually used */
|
||||
. = . + 1992;
|
||||
} > loader
|
||||
|
||||
.persistent_lbas TLOAD_ADDR : {
|
||||
__persistent_lbas_start = .;
|
||||
__persistent_lbas = .;
|
||||
KEEP(*(.header.lbas))
|
||||
. = ALIGN(4);
|
||||
__persistent_lbas_end = .;
|
||||
} > ram
|
||||
|
||||
__ftext_start = ABSOLUTE(.);
|
||||
.text : {
|
||||
__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);
|
||||
__text_end = .;
|
||||
} > ram
|
||||
__ftext_end = ABSOLUTE(.);
|
||||
|
||||
__fdata_start = ABSOLUTE(.);
|
||||
.rodata : {
|
||||
*(.rodata .rodata.* .rdata .rdata.* .gnu.linkonce.r.*)
|
||||
. = ALIGN(16);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
. = ALIGN(16);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
|
||||
. = ALIGN(16);
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*crtend.o(.ctors))
|
||||
__init_array_end = .;
|
||||
|
||||
. = ALIGN(16);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*crtend.o(.dtors))
|
||||
__fini_array_end = .;
|
||||
__build_id = .;
|
||||
*(.note.gnu.build-id)
|
||||
__build_id_end = .;
|
||||
} > ram
|
||||
|
||||
.rodata1 : {
|
||||
*(.rodata1)
|
||||
} > ram
|
||||
|
||||
.data : {
|
||||
__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
|
||||
|
||||
.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 __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
|
||||
|
||||
__heap_start = __bss_end;
|
||||
__end = .;
|
||||
/*
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 PCSX-Redux authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("binary")
|
||||
EXTERN(_ZN10JabyEngine5startEv)
|
||||
ENTRY(_ZN10JabyEngine5startEv)
|
||||
|
||||
TLOAD_ADDR = DEFINED(TLOAD_ADDR) ? TLOAD_ADDR : 0x80010000;
|
||||
|
||||
MEMORY {
|
||||
loader : ORIGIN = (TLOAD_ADDR - 0x800), LENGTH = 2048
|
||||
ram(rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000
|
||||
ram_alt(rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000
|
||||
dcache : ORIGIN = 0x1f800000, LENGTH = 0x400
|
||||
}
|
||||
|
||||
__ram_top = ORIGIN(ram) + LENGTH(ram);
|
||||
__sp = __ram_top - 0x100;
|
||||
|
||||
__dcache = ORIGIN(dcache);
|
||||
__dcache_top = ORIGIN(dcache) + LENGTH(dcache);
|
||||
|
||||
__bss_len = (__bss_end - __bss_start);
|
||||
__ftext_len = (__ftext_end - __ftext_start);
|
||||
__fdata_len = (__planschi_end - __fdata_start);
|
||||
__persistent_lbas_len = (__persistent_lbas_end - __persistent_lbas_start);
|
||||
|
||||
__stack_start = ORIGIN(ram) + LENGTH(ram);
|
||||
|
||||
SECTIONS {
|
||||
/DISCARD/ : { *(.MIPS.abiflags) }
|
||||
|
||||
/* Everything is statically linked, so discard PLTs. */
|
||||
/DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) }
|
||||
|
||||
/* Discard things that the standard link script drops, too. */
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu.*) *(.comment) }
|
||||
}
|
||||
|
||||
/*Overlay sections created by mkoverlay*/
|
||||
INCLUDE Overlays.ld
|
||||
SECTIONS {
|
||||
.planschi __engine_bss_end : SUBALIGN(4)
|
||||
{
|
||||
__planschi_start = .;
|
||||
__boot_loader_start = .;
|
||||
|
||||
*libJabyEngine_*.a:*_boot.o(.text.startup._GLOBAL__*)
|
||||
*_boot.o(.text.startup._GLOBAL__*)
|
||||
*libJabyEngine_*.a:*_boot.o(.ctors)
|
||||
*_boot.o(.ctors)
|
||||
|
||||
*libJabyEngine_*.a:*_boot.o(.text.*)
|
||||
*_boot.o(.text.*)
|
||||
*libJabyEngine_*.a:*_boot.o(.rodata*)
|
||||
*_boot.o(.rodata*)
|
||||
*libJabyEngine_*.a:*_boot.o(.sdata*)
|
||||
*_boot.o(.sdata*)
|
||||
*libJabyEngine_*.a:*_boot.o(.data*)
|
||||
*_boot.o(.data*)
|
||||
*libJabyEngine_*.a:*_boot.o(.sbss*)
|
||||
*_boot.o(.sbss*)
|
||||
*libJabyEngine_*.a:*_boot.o(.bss*)
|
||||
*_boot.o(.bss*)
|
||||
*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 = .;
|
||||
} > ram_alt
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
.PSX_EXE_Header : {
|
||||
/*
|
||||
0x0000 - 0x0007 : "PS-X EXE"
|
||||
*/
|
||||
BYTE(80); BYTE(83); BYTE(45); BYTE(88); BYTE(32); BYTE(69); BYTE(88); BYTE(69);
|
||||
|
||||
/* 0x0008 - 0x000F : skip text_off and data_off since they're not supported by the PS1 BIOS */
|
||||
LONG(0); LONG(0);
|
||||
|
||||
/* 0x0010 - 0x0013 : entry point */
|
||||
LONG(ABSOLUTE(_ZN10JabyEngine5startEv));
|
||||
|
||||
/* 0x0014 - 0x0017 : initial value of $gp */
|
||||
LONG(0);
|
||||
|
||||
/* 0x0018 - 0x001B : Memory address to load "text" section to. */
|
||||
/*
|
||||
NOTE: The "text" section is actually all of the "load"
|
||||
sections of the file including .text, .rodata, .data.
|
||||
etc.
|
||||
*/
|
||||
LONG(TLOAD_ADDR);
|
||||
|
||||
/* 0x001C - 0x001F : size, in bytes, of the "text" section. */
|
||||
LONG(__persistent_lbas_len + __ftext_len + __fdata_len);
|
||||
|
||||
/* 0x0020 - 0x002F :
|
||||
Skip "data_addr", "data_size", "bss_addr" and "bss_size".
|
||||
None of these are supported by retail PS1 BIOS.
|
||||
*/
|
||||
LONG(0); LONG(0);
|
||||
LONG(0); LONG(0);
|
||||
|
||||
/* 0x0030 - 0x0033 : Initial stack address. */
|
||||
LONG(DEFINED(_sp) ? ABSOLUTE(_sp) : 0x801FFF00);
|
||||
|
||||
/* 0x0034 - 0x0037 : Initial stack size, set it to 0. */
|
||||
LONG(0);
|
||||
|
||||
/* Skip the remaining fields as they're not supported by the BIOS */
|
||||
/* e.g. 2048 header bytes minus whatever we've actually used */
|
||||
. = . + 1992;
|
||||
} > loader
|
||||
|
||||
.persistent_lbas TLOAD_ADDR : {
|
||||
__persistent_lbas_start = .;
|
||||
__persistent_lbas = .;
|
||||
KEEP(*(.header.lbas))
|
||||
. = ALIGN(4);
|
||||
__persistent_lbas_end = .;
|
||||
} > ram
|
||||
|
||||
__ftext_start = ABSOLUTE(.);
|
||||
.text : {
|
||||
__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);
|
||||
__text_end = .;
|
||||
} > ram
|
||||
__ftext_end = ABSOLUTE(.);
|
||||
|
||||
__fdata_start = ABSOLUTE(.);
|
||||
.rodata : {
|
||||
*(.rodata .rodata.* .rdata .rdata.* .gnu.linkonce.r.*)
|
||||
. = ALIGN(16);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
. = ALIGN(16);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
|
||||
. = ALIGN(16);
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*crtend.o(.ctors))
|
||||
__init_array_end = .;
|
||||
|
||||
. = ALIGN(16);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*crtend.o(.dtors))
|
||||
__fini_array_end = .;
|
||||
__build_id = .;
|
||||
*(.note.gnu.build-id)
|
||||
__build_id_end = .;
|
||||
} > ram
|
||||
|
||||
.rodata1 : {
|
||||
*(.rodata1)
|
||||
} > ram
|
||||
|
||||
.data : {
|
||||
__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
|
||||
|
||||
.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 __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
|
||||
|
||||
__heap_start = __bss_end;
|
||||
__end = .;
|
||||
}
|
Reference in New Issue
Block a user