Skip to content

Commit 20d0fe9

Browse files
authored
Merge pull request #816 from fjtrujy/srxfixup_zero_text_dectection
srxfixup: detect and fix function symbols at .text offset 0
2 parents 41e0af1 + 1527c2b commit 20d0fe9

34 files changed

Lines changed: 167 additions & 43 deletions

File tree

common/sbus/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IOP_INCS += \
2929

3030
IOP_OBJS_DIR = iop_obj/
3131

32-
IOP_OBJS = ps2_sbus.o iop_sbus.o ps2_sif.o iop_sif2.o sif2cmd.o imports.o exports.o
32+
IOP_OBJS = exports.o iop_sbus.o iop_sif2.o ps2_sbus.o ps2_sif.o sif2cmd.o imports.o
3333

3434
include $(PS2SDKSRC)/Defs.make
3535
include $(PS2SDKSRC)/ee/Rules.lib.make

iop/Rules.make

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,15 @@ $(IOP_BIN_STRIPPED_ELF): $(IOP_BIN_ELF)
145145
$(DIR_GUARD)
146146
$(IOP_STRIP) --strip-unneeded --remove-section=.pdr --remove-section=.comment --remove-section=.mdebug.abi32 --remove-section=.gnu.attributes -o $@ $<
147147

148+
# If the module has no export table, allow symbols at .text offset 0.
149+
# The jal 0x0 hazard only matters when an export table can dispatch to offset 0.
150+
IOP_SRXFIXUP_FLAGS := --rb --irx1
151+
ifeq ($(filter %exports.o,$(IOP_OBJS)),)
152+
IOP_SRXFIXUP_FLAGS += --allow-zero-text
153+
endif
154+
148155
$(IOP_BIN): $(IOP_BIN_STRIPPED_ELF) $(PS2SDKSRC)/tools/srxfixup/bin/srxfixup
149-
$(PS2SDKSRC)/tools/srxfixup/bin/srxfixup --rb --irx1 -o $@ $<
156+
$(PS2SDKSRC)/tools/srxfixup/bin/srxfixup $(IOP_SRXFIXUP_FLAGS) -o $@ $<
150157

151158
$(IOP_LIB)_tmp$(MAKE_CURPID): $(IOP_OBJS)
152159
$(DIR_GUARD)

iop/arcade/acatad/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ IOP_IMPORT_INCS += \
1616
system/threadman
1717

1818
IOP_OBJS = \
19+
exports.o \
1920
acatad.o \
20-
imports.o \
21-
exports.o
21+
imports.o
2222

2323
include $(PS2SDKSRC)/Defs.make
2424
include $(PS2SDKSRC)/iop/Rules.bin.make

iop/arcade/accdvd/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ IOP_IMPORT_INCS += \
1919
system/threadman
2020

2121
IOP_OBJS = \
22+
exports.o \
2223
accdvdi-entry.o \
2324
acd.o \
2425
cdc.o \
2526
cdi.o \
2627
cddrv.o \
2728
cdfs.o \
28-
imports.o \
29-
exports.o
29+
imports.o
3030

3131
include $(PS2SDKSRC)/Defs.make
3232
include $(PS2SDKSRC)/iop/Rules.bin.make

iop/arcade/acdev/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ IOP_IMPORT_INCS += \
1414
system/sysmem
1515

1616
IOP_OBJS = \
17+
exports.o \
1718
acdev.o \
18-
imports.o \
19-
exports.o
19+
imports.o
2020

2121
include $(PS2SDKSRC)/Defs.make
2222
include $(PS2SDKSRC)/iop/Rules.bin.make

iop/arcade/acdev9/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ IOP_IMPORT_INCS += \
1212
system/stdio
1313

1414
IOP_OBJS = \
15+
exports.o \
1516
acdev9.o \
16-
imports.o \
17-
exports.o
17+
imports.o
1818

1919
include $(PS2SDKSRC)/Defs.make
2020
include $(PS2SDKSRC)/iop/Rules.bin.make

iop/cdvd/cdvdfsv/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ IOP_IMPORT_INCS += \
2121
system/sysmem \
2222
system/threadman
2323

24-
IOP_OBJS = cdvdfsv.o imports.o exports.o
24+
IOP_OBJS = exports.o cdvdfsv.o imports.o
2525

2626
include $(PS2SDKSRC)/Defs.make
2727
include $(PS2SDKSRC)/iop/Rules.bin.make

iop/cdvd/cdvdman/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ IOP_IMPORT_INCS += \
1818
system/sysmem \
1919
system/threadman
2020

21-
IOP_OBJS = cdvdman.o imports.o exports.o
21+
IOP_OBJS = exports.o cdvdman.o imports.o
2222

2323
include $(PS2SDKSRC)/Defs.make
2424
include $(PS2SDKSRC)/iop/Rules.bin.make

iop/cdvd/cdvdstm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ IOP_IMPORT_INCS += \
1919
system/sysmem \
2020
system/threadman
2121

22-
IOP_OBJS = cdvdstm.o imports.o exports.o
22+
IOP_OBJS = exports.o cdvdstm.o imports.o
2323

2424
include $(PS2SDKSRC)/Defs.make
2525
include $(PS2SDKSRC)/iop/Rules.bin.make

iop/debug/ioptrap/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ IOP_IMPORT_INCS += \
1717
system/sysclib \
1818
system/threadman
1919

20-
IOP_OBJS = ioptrap.o handler.o breakpoint.o exports.o imports.o
20+
IOP_OBJS = exports.o ioptrap.o handler.o breakpoint.o imports.o
2121

2222
include $(PS2SDKSRC)/Defs.make
2323
include $(PS2SDKSRC)/iop/Rules.bin.make

0 commit comments

Comments
 (0)