From 121b14ddd892d94efc566e51360399be100e495f Mon Sep 17 00:00:00 2001 From: Adrian <4030444+adrian-stepien@users.noreply.github.com> Date: Wed, 28 Oct 2026 07:11:32 +0000 Subject: [PATCH] Use -fno-common consistently in ARM builds GCC 8.5 emits COMMON globals by default. Apply -fno-common in the shared Make and CMake flags so it covers the OS, bootrom and PM5 armlib. Also remove bootrom archives on clean to avoid reusing old library objects. Built OS and bootrom for PM5/RDV4 with GCC 8.5/13.3 using Make and CMake. No COMMON object symbols remain; PM5 CDC state is inside BSS. Existing build warnings remain. No hardware was flashed. --- bootrom/Makefile | 1 + common_arm/Common.cmake | 1 + common_arm/Makefile.common | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bootrom/Makefile b/bootrom/Makefile index 7aa360c3f..f9ac61db7 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -137,6 +137,7 @@ $(OBJDIR)/bootrom.elf: $(VERSIONOBJ) $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ) $(ARMLIB_OB clean: $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.o + $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.a $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.elf $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.s19 $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.map diff --git a/common_arm/Common.cmake b/common_arm/Common.cmake index e6052f776..5b7a4921f 100644 --- a/common_arm/Common.cmake +++ b/common_arm/Common.cmake @@ -106,6 +106,7 @@ set(CROSS_CFLAGS ${CROSS_CFLAGS} ${INCLUDE} # -std=c99 TODO 暂时切换为c11标准,因为新的平台需要c11标准,AT32的官方库一堆c11写法,不这么做的话改起来很麻烦 -std=c11 + -fno-common -DON_DEVICE ${APP_CFLAGS}) set(CROSS_LDFLAGS ${CROSS_LDFLAGS} diff --git a/common_arm/Makefile.common b/common_arm/Makefile.common index 174313200..a9799d5a2 100644 --- a/common_arm/Makefile.common +++ b/common_arm/Makefile.common @@ -97,7 +97,7 @@ ifeq ($(NOERROR),1) endif CROSS_CFLAGS ?= $(DEFCFLAGS) -CROSS_CFLAGS += -c -std=c99 -mthumb-interwork -fno-builtin -ffunction-sections -fdata-sections +CROSS_CFLAGS += -c -std=c99 -mthumb-interwork -fno-builtin -fno-common -ffunction-sections -fdata-sections # stack-protect, no-pie reduces size on Gentoo Hardened 8.2 gcc CROSS_CFLAGS += -fno-stack-protector -fno-pie CROSS_CFLAGS += -DON_DEVICE $(INCLUDE) $(APP_CFLAGS)