Remove `.mdebug` sections by default (#313)

* Add RM_MDEBUG to makefile

* Add to diff settings to allow use of --source
This commit is contained in:
EllipticEllipsis 2021-09-25 14:36:15 +01:00 committed by GitHub
parent 9e4d51fb9f
commit f77cfb9020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -8,6 +8,8 @@ COMPARE ?= 1
NON_MATCHING ?= 0
# If ORIG_COMPILER is 1, compile with QEMU_IRIX and the original compiler
ORIG_COMPILER ?= 0
# Keep .mdebug section in build
KEEP_MDEBUG ?= 0
ifeq ($(NON_MATCHING),1)
CFLAGS := -DNON_MATCHING
@ -68,6 +70,12 @@ LD := $(MIPS_BINUTILS_PREFIX)ld
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
ifeq ($(KEEP_MDEBUG),0)
RM_MDEBUG = $(OBJCOPY) --remove-section .mdebug $@
else
RM_MDEBUG = @:
endif
# Check code syntax with host compiler
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-label
CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D _LANGUAGE_C -D NON_MATCHING -Iinclude -Isrc -Iassets -Ibuild -include stdarg.h $(CHECK_WARNINGS)
@ -236,6 +244,7 @@ init:
build/assets/%.o: assets/%.c
$(CC) -I build/ -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(RM_MDEBUG)
#### Various Recipes ####
@ -263,23 +272,27 @@ build/src/overlays/%.o: src/overlays/%.c
# the following is moved to a separate rule that is only run once when all the required objects have been compiled.
$(ZAPD) bovl -eh -i $@ -cfg $< --outputpath $(@D)/$(notdir $(@D))_reloc.s
(test -f $(@D)/$(notdir $(@D))_reloc.s && $(AS) $(ASFLAGS) $(@D)/$(notdir $(@D))_reloc.s -o $(@D)/$(notdir $(@D))_reloc.o) || true
$(RM_MDEBUG)
build/src/%.o: src/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
@$(OBJDUMP) -d $@ > $(@:.o=.s)
$(RM_MDEBUG)
build/src/libultra/libc/ll.o: src/libultra/libc/ll.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
$(RM_MDEBUG)
build/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
$(RM_MDEBUG)
# Build C files from assets
build/%.inc.c: %.png

View File

@ -5,3 +5,4 @@ def apply(config, args):
config['myimg'] = 'mm.us.rev1.rom_uncompressed.z64'
config['mapfile'] = 'build/mm.map'
config['source_directories'] = ['./src','./include']
config['makeflags'] = ['KEEP_MDEBUG=1']