Skip to content

Commit f3746f3

Browse files
committed
fix: Fixes to export rearrange
Rearrange exports in ps2sdk makefile also Make the export rearrange unconditional Rearrange object files before prepending object directory Create directory for build-exports before continuing
1 parent f188179 commit f3746f3

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

iop/Rules.make

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ ifeq ($(IOP_LINKFILE),)
7878
IOP_LINKFILE := $(PS2SDKSRC)/iop/startup/src/linkfile
7979
endif
8080

81+
# If this build produces an exports.o, ensure it is linked first so the
82+
# export-table object occupies .text offset 0 (helps srxfixup detection).
83+
IOP_OBJS := $(filter exports.o,$(IOP_OBJS)) $(filter-out exports.o,$(IOP_OBJS))
84+
8185
IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)
8286

8387
IOP_BIN_ELF := $(IOP_BIN:.irx=.notiopmod.elf)

samples/Makefile.iopglobal_sample

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,12 @@ ifeq ($(IOP_LINKFILE),)
7272
IOP_LINKFILE := $(PS2SDK)/iop/startup/linkfile
7373
endif
7474

75-
# Populate object paths
76-
IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)
77-
7875
# If this build produces an exports.o, ensure it is linked first so the
7976
# 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
77+
IOP_OBJS := $(filter exports.o,$(IOP_OBJS)) $(filter-out exports.o,$(IOP_OBJS))
78+
79+
# Populate object paths
80+
IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)
8381

8482
# srxfixup flags: default to `--rb --irx1`. If this module does not build an
8583
# exports.o, add `--allow-zero-text` (modules without an export table may
@@ -132,6 +130,7 @@ $(IOP_OBJS_DIR)imports.o: $(IOP_OBJS_DIR)build-imports.c
132130

133131
# Rules to build exports.tab.
134132
$(IOP_OBJS_DIR)build-exports.c: $(IOP_SRC_DIR)exports.tab
133+
$(DIR_GUARD)
135134
$(PRINTF) '%s\n' "#include \"irx.h\"" > $@
136135
cat $< >> $@
137136

0 commit comments

Comments
 (0)