Skip to content

Commit f556130

Browse files
authored
Merge pull request #818 from uyjulian/fix_exports_rearrange
fix: Fixes to export rearrange
2 parents f188179 + fbdc7ec commit f556130

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
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)

iop/iLink/iLinkman/src/exports.tab

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
void _funcret(){};
21

32
DECLARE_EXPORT_TABLE(iLinkman, 1, 1)
43
DECLARE_EXPORT(_start) /* 000 */
5-
DECLARE_EXPORT(_funcret)
4+
DECLARE_EXPORT(_retonly)
65
DECLARE_EXPORT(_exit) /* 002 */
7-
DECLARE_EXPORT(_funcret) /* 003 */
6+
DECLARE_EXPORT(_retonly) /* 003 */
87
DECLARE_EXPORT(iLinkEnableSBus) /* 004 */
98
DECLARE_EXPORT(iLinkDisableSBus) /* 005 */
109
DECLARE_EXPORT(iLinkResetSBus) /* 006 */
@@ -28,3 +27,5 @@ DECLARE_EXPORT_TABLE(iLinkman, 1, 1)
2827
DECLARE_EXPORT(iLinkReadCROM) /* 024 */
2928
DECLARE_EXPORT(iLinkGetLocalNodeEUI64) /* 025 */
3029
END_EXPORT_TABLE
30+
31+
void _retonly(){};

iop/security/secrman/src/exports.tab

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
void _funcret(){};
21

32
// El_isra: this was 0x1, 0x3 originally. but the IRX_ID macro on source code has 0x1, 0x4. just like arcade SECRMAN...
43
DECLARE_EXPORT_TABLE(secrman, 0x01, 0x04)
54
DECLARE_EXPORT(_start)
6-
DECLARE_EXPORT(_funcret)
5+
DECLARE_EXPORT(_retonly)
76
DECLARE_EXPORT(_exit)
8-
DECLARE_EXPORT(_funcret)
7+
DECLARE_EXPORT(_retonly)
98
DECLARE_EXPORT(SecrSetMcCommandHandler) /* 004 */
109
DECLARE_EXPORT(SecrSetMcDevIDHandler) /* 005 */
1110
DECLARE_EXPORT(SecrAuthCard) /* 006 */
@@ -26,3 +25,5 @@ DECLARE_EXPORT_TABLE(secrman, 0x01, 0x04)
2625
DECLARE_EXPORT(SecrAuthDongle) /* 020 */
2726
#endif
2827
END_EXPORT_TABLE
28+
29+
void _retonly(){};
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
void _funcret(){};
21

32
DECLARE_EXPORT_TABLE(secrsif, 1, 1)
43
DECLARE_EXPORT(_start)
5-
DECLARE_EXPORT(_funcret)
6-
DECLARE_EXPORT(_funcret)
7-
DECLARE_EXPORT(_funcret)
4+
DECLARE_EXPORT(_retonly)
5+
DECLARE_EXPORT(_retonly)
6+
DECLARE_EXPORT(_retonly)
87
END_EXPORT_TABLE
8+
9+
void _retonly(){};

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)