Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ build/
expected/
notes/
tools/gcc
tools/egcs
tools/egcs_original
tools/ido
*.elf
*.o
*.a

# Tool artifacts
ctx.c
ctx.c.m2c

libultra_collection/
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ ifeq ($(findstring _rom,$(TARGET)),_rom)
CPPFLAGS += -D_FINALROM
endif

ifneq ($(COMPILER),ido)
ifeq ($(COMPARE),0)
CPPFLAGS += -D ASM_FIXUPS=1
endif
endif

SRC_DIRS := $(shell find src -type d)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
S_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.s))
Expand Down
20 changes: 16 additions & 4 deletions include/sys/asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {


/* libgultra doesn't match with the .type directive but iQue sdk asm.h uses it */
#ifdef BBPLAYER
#if defined(BBPLAYER) || (defined(ASM_FIXUPS) && !defined(__sgi))
#define ASM_TYPE_FUNC(x) .type x, @function
#else
#define ASM_TYPE_FUNC(x)
Expand All @@ -48,7 +48,7 @@ extern "C" {
x: ;\
.frame sp,0,ra

#if defined(BBPLAYER) || defined(__sgi)
#if defined(BBPLAYER) || defined(__sgi) || defined(ASM_FIXUPS)
#define XLEAF(x) \
.globl x ;\
.aent x,0 ;\
Expand All @@ -58,7 +58,7 @@ extern "C" {
.globl x
#endif

#ifdef BBPLAYER
#if defined(BBPLAYER) || (defined(ASM_FIXUPS) && !defined(__sgi))
#define END(proc) \
.end proc ;\
.size proc, . - proc
Expand All @@ -67,6 +67,18 @@ extern "C" {
.end proc
#endif

/* Some specific asm functions (guMtxCatF, _bcmp, _bcopy, _bzero) do not use a .size directive
in any known libultra version, so this macro is used to allow using said directive on those
functions without breaking matching the archives. */
#if (defined(ASM_FIXUPS) && !defined(__sgi))
#define END2(proc) \
.end proc ;\
.size proc, . - proc
#else
#define END2(proc) \
.end proc
#endif

#define ABS(x, y) \
.globl x ;\
x = y
Expand All @@ -75,7 +87,7 @@ extern "C" {
.globl x ;\
x:

#if defined(BBPLAYER) || defined(__sgi)
#if defined(BBPLAYER) || defined(__sgi) || defined(ASM_FIXUPS)
#define WEAK(x, y) \
.weakext x, y
#else
Expand Down
2 changes: 1 addition & 1 deletion makefiles/modern_gcc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WARNINGS += -Wno-int-conversion -Wno-incompatible-pointer-types -Wno-implicit-fu
CFLAGS := -G 0 -c -nostdinc -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -fbuiltin -fno-builtin-sinf -fno-builtin-cosf -funsigned-char $(WARNINGS)
CFLAGS += -fno-strict-aliasing # TODO: Try adjusting code to remove this
ASFLAGS := -w -nostdinc -c -G 0 -march=vr4300 -mgp32 -mfp32 -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_MIPS_SIM=1 -D_ULTRA64
CPPFLAGS = -DMODERN_CC -D_MIPS_SZLONG=32 -D__USE_ISOC99 $(GBIDEFINE) $(VERSION_DEFINE) $(DEBUGFLAG)
CPPFLAGS = -DMODERN_CC -D ASM_FIXUPS=1 -D_MIPS_SZLONG=32 -D__USE_ISOC99 $(GBIDEFINE) $(VERSION_DEFINE) $(DEBUGFLAG)
IINC = -I . -I $(WORKING_DIR)/include -I $(WORKING_DIR)/include/compiler/modern_gcc -I $(WORKING_DIR)/include/PR
MIPS_VERSION := -mips3
ASOPTFLAGS :=
Expand Down
2 changes: 1 addition & 1 deletion src/libc/bcmp.s
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ cmpne:
li v0, 1
jr ra

.end _bcmp
END2(_bcmp)
2 changes: 1 addition & 1 deletion src/libc/bcopy.s
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,4 @@ backwards_4:
addiu a2, a2, -4
b backwards_4

.end _bcopy
END2(_bcopy)
2 changes: 1 addition & 1 deletion src/libc/bzero.s
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ bytezero:
zerodone:
jr ra

.end _bzero
END2(_bzero)
13 changes: 13 additions & 0 deletions src/mgu/asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,27 @@ extern "C" {
/* NABI32 is 64bit calling convention but 32bit type sizes) */
#define _MIPS_SIM_ABI64 3 /* MIPS 64 calling convention */

#if (defined(ASM_FIXUPS) && !defined(__sgi))
#define ASM_TYPE_FUNC(x) .type x, @function
#else
#define ASM_TYPE_FUNC(x)
#endif

#define LEAF(x) \
.globl x; \
ASM_TYPE_FUNC(x) ;\
.ent x,0; \
x:; \
.frame sp,0,ra

#if (defined(ASM_FIXUPS) && !defined(__sgi))
#define END(proc) \
.end proc ;\
.size proc, . - proc
#else
#define END(proc) \
.end proc
#endif


#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion src/mgu/mtxcatf.s
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ label_loop_j:
addu sp , FRAME_SIZE
j ra

.end guMtxCatF
END(guMtxCatF)

/* end of file */