Message ID | 20230405234859.1446811-5-trini@konsulko.com |
---|---|
State | Accepted |
Commit | a27c8ea7f7fc269c2bf40468568a387d9e8db976 |
Delegated to: | Tom Rini |
Headers | show |
Series | Update clang support for ARM | expand |
On Thu, 6 Apr 2023 at 11:50, Tom Rini <trini@konsulko.com> wrote: > > When building for ARM64, we need to pass -ffixed-x18 and otherwise pass > -ffixed-r9. Rather than having this logic in two places, we can do this > once in arch/arm/config.mk. Further, while gcc will ignore being passed > both -ffixed-r9 and -ffixed-x18 and simply use -ffixed-x18, clang will > note that -ffixed-r9 is not used. Remove this duplication to also remove > the warning. > > Signed-off-by: Tom Rini <trini@konsulko.com> > --- > arch/arm/config.mk | 10 ++++++++-- > arch/arm/cpu/armv8/config.mk | 1 - > 2 files changed, 8 insertions(+), 3 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Wed, Apr 05, 2023 at 07:48:54PM -0400, Tom Rini wrote: > When building for ARM64, we need to pass -ffixed-x18 and otherwise pass > -ffixed-r9. Rather than having this logic in two places, we can do this > once in arch/arm/config.mk. Further, while gcc will ignore being passed > both -ffixed-r9 and -ffixed-x18 and simply use -ffixed-x18, clang will > note that -ffixed-r9 is not used. Remove this duplication to also remove > the warning. > > Signed-off-by: Tom Rini <trini@konsulko.com> > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks! > arch/arm/cpu/armv8/config.mk | 1 - > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/config.mk b/arch/arm/config.mk > index bf781f102620..5530d02b66c4 100644 > --- a/arch/arm/config.mk > +++ b/arch/arm/config.mk > @@ -3,7 +3,13 @@ > # (C) Copyright 2000-2002 > # Wolfgang Denk, DENX Software Engineering, wd@denx.de. > > -CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \ > +ifeq ($(CONFIG_ARM64),y) > +FIXED_REG := -ffixed-x18 > +else > +FIXED_REG := -ffixed-r9 > +endif > + > +CFLAGS_NON_EFI := -fno-pic $(FIXED_REG) -ffunction-sections -fdata-sections \ > -fstack-protector-strong > CFLAGS_EFI := -fpic -fshort-wchar > > @@ -15,7 +21,7 @@ ifneq ($(LTO_ENABLE),y) > PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections > endif > > -PLATFORM_RELFLAGS += -fno-common -ffixed-r9 > +PLATFORM_RELFLAGS += -fno-common $(FIXED_REG) > PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ > $(call cc-option,-mgeneral-regs-only) \ > $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) > diff --git a/arch/arm/cpu/armv8/config.mk b/arch/arm/cpu/armv8/config.mk > index ca06ed3d4f92..4d74b2a533e0 100644 > --- a/arch/arm/cpu/armv8/config.mk > +++ b/arch/arm/cpu/armv8/config.mk > @@ -2,7 +2,6 @@ > # > # (C) Copyright 2002 > # Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> > -PLATFORM_RELFLAGS += -fno-common -ffixed-x18 > PLATFORM_RELFLAGS += $(call cc-option,-mbranch-protection=none) > > PF_NO_UNALIGNED := $(call cc-option, -mstrict-align)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk index bf781f102620..5530d02b66c4 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -3,7 +3,13 @@ # (C) Copyright 2000-2002 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \ +ifeq ($(CONFIG_ARM64),y) +FIXED_REG := -ffixed-x18 +else +FIXED_REG := -ffixed-r9 +endif + +CFLAGS_NON_EFI := -fno-pic $(FIXED_REG) -ffunction-sections -fdata-sections \ -fstack-protector-strong CFLAGS_EFI := -fpic -fshort-wchar @@ -15,7 +21,7 @@ ifneq ($(LTO_ENABLE),y) PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections endif -PLATFORM_RELFLAGS += -fno-common -ffixed-r9 +PLATFORM_RELFLAGS += -fno-common $(FIXED_REG) PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ $(call cc-option,-mgeneral-regs-only) \ $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) diff --git a/arch/arm/cpu/armv8/config.mk b/arch/arm/cpu/armv8/config.mk index ca06ed3d4f92..4d74b2a533e0 100644 --- a/arch/arm/cpu/armv8/config.mk +++ b/arch/arm/cpu/armv8/config.mk @@ -2,7 +2,6 @@ # # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> -PLATFORM_RELFLAGS += -fno-common -ffixed-x18 PLATFORM_RELFLAGS += $(call cc-option,-mbranch-protection=none) PF_NO_UNALIGNED := $(call cc-option, -mstrict-align)
When building for ARM64, we need to pass -ffixed-x18 and otherwise pass -ffixed-r9. Rather than having this logic in two places, we can do this once in arch/arm/config.mk. Further, while gcc will ignore being passed both -ffixed-r9 and -ffixed-x18 and simply use -ffixed-x18, clang will note that -ffixed-r9 is not used. Remove this duplication to also remove the warning. Signed-off-by: Tom Rini <trini@konsulko.com> --- arch/arm/config.mk | 10 ++++++++-- arch/arm/cpu/armv8/config.mk | 1 - 2 files changed, 8 insertions(+), 3 deletions(-)