Use `gcc -E` for `cpp` (#1639)

* Fix cpp for macs?

* Add comment

* Move cppflags with cpp
This commit is contained in:
Derek Hensley 2024-05-26 20:01:31 -07:00 committed by GitHub
parent b7e5468ca1
commit 659e2b5088
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 11 deletions

View File

@ -87,12 +87,6 @@ BASEROM_DIR := baseroms/$(VERSION)
BUILD_DIR := build/$(VERSION)
EXTRACTED_DIR := extracted/$(VERSION)
CPPFLAGS += -P
ifeq ($(DETECTED_OS), macos)
CPPFLAGS += -xc++
endif
#### Tools ####
ifneq ($(shell type $(MIPS_BINUTILS_PREFIX)ld >/dev/null 2>/dev/null; echo $$?), 0)
@ -143,7 +137,11 @@ ifeq ($(RUN_CC_CHECK),0)
CC_CHECK_COMP := @:
endif
CPP := cpp
# The `cpp` command behaves differently on macOS (it behaves as if
# `-traditional-cpp` was passed) so we use `gcc -E` instead.
CPP := gcc -E
CPPFLAGS += -P -xc -fno-dollars-in-identifiers
MKLDSCRIPT := tools/buildtools/mkldscript
MKDMADATA := tools/buildtools/mkdmadata
ZAPD := tools/ZAPD/ZAPD.out

View File

@ -1097,10 +1097,10 @@ def find_symbols_in_rodata(section):
def asm_header(section_name: str):
return f""".include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section {section_name}