Skip to content

Commit

Permalink
Revert "change: Use ELF toolchain and iopfixup to build IRX"
Browse files Browse the repository at this point in the history
This reverts commit 00f199a.
  • Loading branch information
rickgaiser committed Jan 31, 2025
1 parent 236e1c0 commit 996a592
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Defs.make
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ EE_PKG_CONFIG ?= $(EE_TOOL_PREFIX)pkg-config
# Defintions for the IOP toolchain.
#

IOP_TOOL_PREFIX ?= mipsel-none-elf-
IOP_TOOL_PREFIX ?= mipsel-ps2-irx-
IOP_CC ?= $(IOP_TOOL_PREFIX)gcc
IOP_AS ?= $(IOP_TOOL_PREFIX)as
IOP_LD ?= $(IOP_TOOL_PREFIX)ld
Expand Down
25 changes: 3 additions & 22 deletions iop/Rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ifeq ($(DEBUG),1)
IOP_CFLAGS += -DDEBUG
endif
# Linker flags
IOP_LDFLAGS := -nostdlib -dc -r $(IOP_LDFLAGS)
IOP_LDFLAGS := -nostdlib -s $(IOP_LDFLAGS)

# Additional C compiler flags for GCC >=v5.3.0
# -msoft-float is to "remind" GCC/Binutils that the soft-float ABI is to be used. This is due to a bug, which
Expand Down Expand Up @@ -69,17 +69,8 @@ endif
# Assembler flags
IOP_ASFLAGS := $(ASFLAGS_TARGET) -EL -G0 $(IOP_ASFLAGS)

# Default link file
ifeq ($(IOP_LINKFILE),)
IOP_LINKFILE := $(PS2SDKSRC)/iop/startup/src/linkfile
endif

IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)

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

IOP_BIN_STRIPPED_ELF := $(IOP_BIN:.irx=.notiopmod.stripped.elf)

# Externally defined variables: IOP_BIN, IOP_OBJS, IOP_LIB

# These macros can be used to simplify certain build rules.
Expand All @@ -104,9 +95,6 @@ $(IOP_OBJS_DIR)%.o: $(IOP_SRC_DIR)%.s

.INTERMEDIATE:: $(IOP_LIB)_tmp$(MAKE_CURPID) $(IOP_OBJS_DIR)build-imports.c $(IOP_OBJS_DIR)build-exports.c

$(PS2SDKSRC)/tools/srxfixup/bin/srxfixup: $(PS2SDKSRC)/tools/srxfixup
$(MAKEREC) $<

$(IOP_OBJS_DIR)template-imports.h:
$(DIR_GUARD)
$(PRINTF) '%s\n' "#include \"irx_imports.h\"" > $@
Expand All @@ -133,16 +121,9 @@ $(IOP_OBJS_DIR)exports.o: $(IOP_OBJS_DIR)build-exports.c
$(DIR_GUARD)
$(IOP_C_COMPILE) $(IOP_IETABLE_CFLAGS) -c $< -o $@

$(IOP_BIN_ELF): $(IOP_OBJS) $(IOP_LIB_ARCHIVES) $(IOP_ADDITIONAL_DEPS)
$(DIR_GUARD)
$(IOP_C_COMPILE) -T$(IOP_LINKFILE) $(IOP_OPTFLAGS) -o $@ $(IOP_OBJS) $(IOP_LDFLAGS) $(IOP_LIB_ARCHIVES) $(IOP_LIBS)

$(IOP_BIN_STRIPPED_ELF): $(IOP_BIN_ELF)
$(IOP_BIN): $(IOP_OBJS) $(IOP_LIB_ARCHIVES) $(IOP_ADDITIONAL_DEPS)
$(DIR_GUARD)
$(IOP_STRIP) --strip-unneeded --remove-section=.pdr --remove-section=.comment --remove-section=.mdebug.abi32 --remove-section=.gnu.attributes -o $@ $<

$(IOP_BIN): $(IOP_BIN_STRIPPED_ELF) $(PS2SDKSRC)/tools/srxfixup/bin/srxfixup
$(PS2SDKSRC)/tools/srxfixup/bin/srxfixup --irx1 -o $@ $<
$(IOP_C_COMPILE) $(IOP_OPTFLAGS) -o $(IOP_BIN) $(IOP_OBJS) $(IOP_LDFLAGS) $(IOP_LIB_ARCHIVES) $(IOP_LIBS)

$(IOP_LIB)_tmp$(MAKE_CURPID): $(IOP_OBJS)
$(DIR_GUARD)
Expand Down
4 changes: 2 additions & 2 deletions iop/startup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ release:
@$(PRINTF) 'Installing %slinkfile into %s/iop/startup\n' $(IOP_SRC_DIR) $(PS2SDK)
$(ECHO) Installing $(IOP_SRC_DIR)linkfile into $(PS2SDK)/iop/startup
cp -f $(IOP_SRC_DIR)linkfile $(PS2SDK)/iop/startup
@$(ECHO) Installing $(IOP_OBJS_DIR)crt0.o into $(PS2DEV)/iop/mipsel-none-elf/lib
cp -f $(IOP_OBJS_DIR)crt0.o $(PS2DEV)/iop/mipsel-none-elf/lib
@$(ECHO) Installing $(IOP_OBJS_DIR)crt0.o into $(PS2DEV)/ee/mipsel-ps2-irx/lib
cp -f $(IOP_OBJS_DIR)crt0.o $(PS2DEV)/iop/mipsel-ps2-irx/lib
23 changes: 3 additions & 20 deletions samples/Makefile.iopglobal_sample
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ IOP_DBGINFOFLAGS ?= -gdwarf-2 -gz
# for finer-grained control over what goes into each IRX.
IOP_CFLAGS := -D_IOP -fno-builtin -G0 $(IOP_OPTFLAGS) $(IOP_WARNFLAGS) $(IOP_DBGINFOFLAGS) $(IOP_INCS) $(IOP_CFLAGS)
# linker flags
IOP_LDFLAGS := -nostdlib -dc -r $(IOP_LDFLAGS)
IOP_LDFLAGS := -nostdlib -s $(IOP_LDFLAGS)

# Additional C compiler flags for GCC >=v5.3.0
# -msoft-float is to "remind" GCC/Binutils that the soft-float ABI is to be used. This is due to a bug, which
Expand Down Expand Up @@ -67,17 +67,8 @@ endif
# Assembler flags
IOP_ASFLAGS := $(ASFLAGS_TARGET) -EL -G0 $(IOP_ASFLAGS)

# Default link file
ifeq ($(IOP_LINKFILE),)
IOP_LINKFILE := $(PS2SDK)/iop/startup/linkfile
endif

IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)

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

IOP_BIN_STRIPPED_ELF := $(IOP_BIN:.irx=.notiopmod.stripped.elf)

# Externally defined variables: IOP_BIN, IOP_OBJS, IOP_LIB

# These macros can be used to simplify certain build rules.
Expand Down Expand Up @@ -119,17 +110,9 @@ $(IOP_OBJS_DIR)exports.o: $(IOP_OBJS_DIR)build-exports.c
$(DIR_GUARD)
$(IOP_C_COMPILE) $(IOP_IETABLE_CFLAGS) -c $< -o $@

$(IOP_BIN_ELF): $(IOP_OBJS)
$(DIR_GUARD)
$(IOP_C_COMPILE) -T$(IOP_LINKFILE) $(IOP_OPTFLAGS) -o $@ $(IOP_OBJS) $(IOP_LDFLAGS) $(IOP_LIBS)

$(IOP_BIN_STRIPPED_ELF): $(IOP_BIN_ELF)
$(DIR_GUARD)
$(IOP_STRIP) --strip-unneeded --remove-section=.pdr --remove-section=.comment --remove-section=.mdebug.abi32 --remove-section=.gnu.attributes -o $@ $<

$(IOP_BIN): $(IOP_BIN_STRIPPED_ELF)
$(IOP_BIN): $(IOP_OBJS)
$(DIR_GUARD)
iopfixup --irx1 -o $@ $<
$(IOP_C_COMPILE) $(IOP_OPTFLAGS) -o $(IOP_BIN) $(IOP_OBJS) $(IOP_LDFLAGS) $(IOP_LIBS)

$(IOP_LIB): $(IOP_OBJS)
$(DIR_GUARD)
Expand Down
2 changes: 1 addition & 1 deletion samples/Makefile.pref_sample
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ EE_RANLIB ?= $(EE_TOOL_PREFIX)ranlib
# Defintions for the IOP toolchain.
#

IOP_TOOL_PREFIX ?= mipsel-none-elf-
IOP_TOOL_PREFIX ?= mipsel-ps2-irx-
IOP_CC ?= $(IOP_TOOL_PREFIX)gcc
IOP_AS ?= $(IOP_TOOL_PREFIX)as
IOP_LD ?= $(IOP_TOOL_PREFIX)ld
Expand Down
4 changes: 2 additions & 2 deletions samples/ps2dev_iop.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ endif()
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR mips)
SET(CMAKE_C_COMPILER mipsel-none-elf-gcc)
SET(CMAKE_CXX_COMPILER mipsel-none-elf-g++)
SET(CMAKE_C_COMPILER mipsel-ps2-irx-gcc)
SET(CMAKE_CXX_COMPILER mipsel-ps2-irx-g++)
SET(CMAKE_C_COMPILER_WORKS 1) #Hack by f0bes
SET(CMAKE_CXX_COMPILER_WORKS 1) #Hack by f0bes

Expand Down

0 comments on commit 996a592

Please sign in to comment.