diff options
| author | Xavi Del Campo <xavi.dcr@tutanota.com> | 2020-01-31 10:32:23 +0100 |
|---|---|---|
| committer | Xavi Del Campo <xavi.dcr@tutanota.com> | 2020-01-31 10:32:23 +0100 |
| commit | 7c24e9a9b02b04dcaf9507acb94091ea70a2c02d (patch) | |
| tree | c28d0748652ad4b4222309e46e6cfc82c0906220 /misc | |
| parent | a2b7b6bb1cc2f4a3258b7b2dbc92399d151f864d (diff) | |
| download | psxsdk-7c24e9a9b02b04dcaf9507acb94091ea70a2c02d.tar.gz | |
Imported pristine psxsdk-20190410 from official repo
Diffstat (limited to 'misc')
| -rw-r--r-- | misc/Makefile | 16 | ||||
| -rwxr-xr-x | misc/genscripts.sh | 82 |
2 files changed, 98 insertions, 0 deletions
diff --git a/misc/Makefile b/misc/Makefile new file mode 100644 index 0000000..295732b --- /dev/null +++ b/misc/Makefile @@ -0,0 +1,16 @@ +include ../Makefile.cfg + +all: + sh genscripts.sh $(TOOLCHAIN_PREFIX) + +clean: + rm -f playstation.x psx-gcc psx-g++ + +distclean: clean + +install: all + mkdir -p $(TOOLCHAIN_PREFIX)/bin + mkdir -p $(TOOLCHAIN_PREFIX)/mipsel-unknown-elf/lib/ldscripts + cp -v psx-gcc $(TOOLCHAIN_PREFIX)/bin + cp -v psx-g++ $(TOOLCHAIN_PREFIX)/bin + cp -v playstation.x $(TOOLCHAIN_PREFIX)/mipsel-unknown-elf/lib/ldscripts diff --git a/misc/genscripts.sh b/misc/genscripts.sh new file mode 100755 index 0000000..537c847 --- /dev/null +++ b/misc/genscripts.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +# This shell script will generate the playstation.x linker script, and the psx-gcc and psx-elf2x shell scripts. + +# You have to pass the PREFIX of the toolchain as the first argument of this shell script + +echo "/* + * Linker script to generate an ELF file + * that has to be converted to PS-X EXE. + */ + +TARGET(\"elf32-littlemips\") +OUTPUT_ARCH(\"mips\") + +ENTRY(\"_start\") + +SEARCH_DIR(\"$1/lib\") +STARTUP(start.o) +INPUT(-lpsx -lgcc) + +SECTIONS +{ + . = 0x80010000; + + .text ALIGN(4) : + { + *(.text*) + } + + .rodata ALIGN(4) : + { + *(.rodata) + } + + .data ALIGN(4) : + { + *(.data) + } + + .ctors ALIGN(4) : + { + *(.ctors) + } + + .dtors ALIGN(4) : + { + *(.dtors) + } + + .bss ALIGN(4) : + { + *(.bss) + } + + __text_start = ADDR(.text); + __text_end = ADDR(.text) + SIZEOF(.text); + + __rodata_start = ADDR(.rodata); + __rodata_end = ADDR(.rodata) + SIZEOF(.rodata); + + __data_start = ADDR(.data); + __data_end = ADDR(.data) + SIZEOF(.data); + + __ctor_list = ADDR(.ctors); + __ctor_end = ADDR(.ctors) + SIZEOF(.ctors); + + __dtor_list = ADDR(.dtors); + __dtor_end = ADDR(.dtors) + SIZEOF(.dtors); + + __bss_start = ADDR(.bss); + __bss_end = ADDR(.bss) + SIZEOF(.bss); + + __scratchpad = 0x1f800000; +} +" > playstation.x + +echo "#!/bin/sh +mipsel-unknown-elf-gcc -D__PSXSDK__ -fno-strict-overflow -fsigned-char -msoft-float -mno-gpopt -fno-builtin -G0 -I$1/include -T $1/mipsel-unknown-elf/lib/ldscripts/playstation.x \$*"> psx-gcc +chmod +x psx-gcc +echo "#!/bin/sh +mipsel-unknown-elf-g++ -D__PSXSDK__ -fno-strict-overflow -fsigned-char -msoft-float -mno-gpopt -fno-builtin -G0 -I$1/include -T $1/mipsel-unknown-elf/lib/ldscripts/playstation.x -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-use-cxa-atexit \$*" > psx-g++ +chmod +x psx-g++ |
