Skip to content

Commit 916edea

Browse files
committed
iop: default srxfixup flags & allow zero-.text for non-exporting modules
Default IOP_SRXFIXUP_FLAGS to --rb --irx1 and use it for the iopfixup invocation. When the build does not produce exports.o, append --allow-zero-text so modules without an export table do not fail the zero-.text check. This keeps behavior consistent with iop/Rules.make while allowing top-level Makefiles to override IOP_SRXFIXUP_FLAGS when needed.
1 parent 20d0fe9 commit 916edea

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

samples/Makefile.iopglobal_sample

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,24 @@ ifeq ($(IOP_LINKFILE),)
7272
IOP_LINKFILE := $(PS2SDK)/iop/startup/linkfile
7373
endif
7474

75+
# Populate object paths
7576
IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)
7677

78+
# If this build produces an exports.o, ensure it is linked first so the
79+
# export-table object occupies .text offset 0 (helps srxfixup detection).
80+
ifneq (,$(filter $(IOP_OBJS_DIR)exports.o,$(IOP_OBJS)))
81+
IOP_OBJS := $(IOP_OBJS_DIR)exports.o $(filter-out $(IOP_OBJS_DIR)exports.o,$(IOP_OBJS))
82+
endif
83+
84+
# srxfixup flags: default to `--rb --irx1`. If this module does not build an
85+
# exports.o, add `--allow-zero-text` (modules without an export table may
86+
# legitimately lack an STT_OBJECT at .text offset 0). Top-level Makefiles may
87+
# override `IOP_SRXFIXUP_FLAGS` if they need custom behaviour.
88+
IOP_SRXFIXUP_FLAGS := --rb --irx1
89+
ifeq (,$(filter $(IOP_OBJS_DIR)exports.o,$(IOP_OBJS)))
90+
IOP_SRXFIXUP_FLAGS += --allow-zero-text
91+
endif
92+
7793
IOP_BIN_ELF := $(IOP_BIN:.irx=.notiopmod.elf)
7894

7995
IOP_BIN_STRIPPED_ELF := $(IOP_BIN:.irx=.notiopmod.stripped.elf)
@@ -133,7 +149,7 @@ $(IOP_BIN_STRIPPED_ELF): $(IOP_BIN_ELF)
133149

134150
$(IOP_BIN): $(IOP_BIN_STRIPPED_ELF)
135151
$(DIR_GUARD)
136-
iopfixup --irx1 -o $@ $<
152+
iopfixup $(IOP_SRXFIXUP_FLAGS) -o $@ $<
137153

138154
$(IOP_LIB): $(IOP_OBJS)
139155
$(DIR_GUARD)

0 commit comments

Comments
 (0)