Fix INCLUDE_IMG and INCLUDE_PAL on modern GCC (#1143)

* fix INCLUDE_IMG and INCLUDE_PAL on modern GCC

* use .pushsection/.popsection

* use pushsection/popsection on modern compiler only

* add gcc-mips-linux-gnu to debian deps

* remove rogue )

* move -DMODERN_COMPILER to cflags_modern
This commit is contained in:
Alex Bates 2024-01-09 05:20:24 +00:00 committed by GitHub
parent 070a5488d0
commit 029de584b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -3,15 +3,24 @@
#define ASTRINGIFY_(x) #x
#define ASTRINGIFY(x) ASTRINGIFY_(x)
#ifdef MODERN_COMPILER
# define PUSHSECTION(SECTION) ".pushsection " SECTION "\n"
# define POPSECTION ".popsection\n"
#else
# define PUSHSECTION(SECTION) SECTION "\n"
# define POPSECTION
#endif
#define _INCLUDE_IMG(FILENAME, SYMBOLNAME) \
extern unsigned char SYMBOLNAME[]; \
__asm__( \
".globl " #SYMBOLNAME"\n" \
".data\n" \
PUSHSECTION(".data") \
".align 2\n" \
".type " #SYMBOLNAME", @object\n" \
#SYMBOLNAME":\n" \
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
POPSECTION \
)
// two macros are needed for N() usage
@ -22,11 +31,12 @@
extern unsigned short SYMBOLNAME[]; \
__asm__( \
".globl " #SYMBOLNAME"\n" \
".data\n" \
PUSHSECTION(".data") \
".align 2\n" \
".type " #SYMBOLNAME", @object\n" \
#SYMBOLNAME":\n" \
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
POPSECTION \
)
#endif // _H_INCLUDE_ASSET

View File

@ -37,7 +37,7 @@ if cat /etc/os-release | grep -E 'ID=debian|ID_LIKE=(.*)debian' &> /dev/null; th
echo "Installing packages for Debian or derivative (apt)"
${SUDO} apt install -y curl git python3 python3-pip python3-setuptools build-essential binutils-mips-linux-gnu zlib1g-dev libyaml-dev ninja-build cpp-mips-linux-gnu || exit 1
${SUDO} apt install -y curl git python3 python3-pip python3-setuptools build-essential binutils-mips-linux-gnu zlib1g-dev libyaml-dev ninja-build cpp-mips-linux-gnu gcc-mips-linux-gnu || exit 1
python3 -m pip install -U -r requirements.txt
cp tools/precommit_check_no_assets.sh "$(git rev-parse --git-path hooks)/pre-commit" || exit 1

View File

@ -75,7 +75,7 @@ def write_ninja_rules(
cflags = f"-c -G0 -O2 -gdwarf-2 -x c -B {BUILD_TOOLS}/cc/gcc/ {extra_cflags}"
cflags_modern = f"-c -G0 -O2 -gdwarf-2 -fdiagnostics-color=always -fno-builtin-bcopy -fno-tree-loop-distribute-patterns -funsigned-char -mgp32 -mfp32 -mabi=32 -mfix4300 -march=vr4300 -mno-gpopt -fno-toplevel-reorder -mno-abicalls -fno-pic -fno-exceptions -fno-stack-protector -fno-zero-initialized-in-bss -Wno-builtin-declaration-mismatch -x c {extra_cflags}"
cflags_modern = f"-c -G0 -O2 -gdwarf-2 -fdiagnostics-color=always -fno-builtin-bcopy -fno-tree-loop-distribute-patterns -funsigned-char -mgp32 -mfp32 -mabi=32 -mfix4300 -march=vr4300 -mno-gpopt -fno-toplevel-reorder -mno-abicalls -fno-pic -fno-exceptions -fno-stack-protector -fno-zero-initialized-in-bss -Wno-builtin-declaration-mismatch -DMODERN_COMPILER -x c {extra_cflags}"
cflags_272 = f"-c -G0 -mgp32 -mfp32 -mips3 {extra_cflags}"
cflags_272 = cflags_272.replace("-ggdb3", "-g1")