gcc10 LTO - Only specify adhlns assembler options at link time (#15115)

* gcc10 LTO - Only specify adhlns assembler options at link time

* Default adhlns off?
master
Joel Challis 2021-11-12 07:31:40 +00:00 committed by GitHub
parent 479950ca3f
commit f3fa56c32a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 24 deletions

View File

@ -81,7 +81,6 @@ endif
# -f...: tuning, see GCC manual and avr-libc documentation # -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level # -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler. # -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
ifeq ($(strip $(LTO_ENABLE)), yes) ifeq ($(strip $(LTO_ENABLE)), yes)
ifeq ($(PLATFORM),CHIBIOS) ifeq ($(PLATFORM),CHIBIOS)
$(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.) $(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
@ -117,10 +116,6 @@ endif
#CFLAGS += -Wundef #CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code #CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare #CFLAGS += -Wsign-compare
GCC_VERSION := $(shell gcc --version 2>/dev/null)
ifeq ($(findstring clang, ${GCC_VERSION}),)
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
endif
CFLAGS += $(CSTANDARD) CFLAGS += $(CSTANDARD)
# This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION # This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION
@ -133,7 +128,6 @@ CFLAGS += -fcommon
# -f...: tuning, see GCC manual and avr-libc documentation # -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level # -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler. # -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
ifeq ($(strip $(DEBUG_ENABLE)),yes) ifeq ($(strip $(DEBUG_ENABLE)),yes)
CXXFLAGS += -g$(DEBUG) CXXFLAGS += -g$(DEBUG)
endif endif
@ -152,28 +146,10 @@ endif
#CXXFLAGS += -Wstrict-prototypes #CXXFLAGS += -Wstrict-prototypes
#CXXFLAGS += -Wunreachable-code #CXXFLAGS += -Wunreachable-code
#CXXFLAGS += -Wsign-compare #CXXFLAGS += -Wsign-compare
ifeq ($(findstring clang, ${GCC_VERSION}),)
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
endif
#CXXFLAGS += $(CSTANDARD) #CXXFLAGS += $(CSTANDARD)
#---------------- Assembler Options ---------------- #---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS += $(ADEFS) ASFLAGS += $(ADEFS)
ifeq ($(findstring clang, ${GCC_VERSION}),)
ifeq ($(strip $(DEBUG_ENABLE)),yes)
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
else
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
endif
endif
ifeq ($(VERBOSE_AS_CMD),yes) ifeq ($(VERBOSE_AS_CMD),yes)
ASFLAGS += -v ASFLAGS += -v
endif endif
@ -230,6 +206,32 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
# You can give EXTRALDFLAGS at 'make' command line. # You can give EXTRALDFLAGS at 'make' command line.
LDFLAGS += $(EXTRALDFLAGS) LDFLAGS += $(EXTRALDFLAGS)
#---------------- Assembler Listings ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ADHLNS_ENABLE ?= no
ifeq ($(ADHLNS_ENABLE),yes)
# Avoid "Options to '-Xassembler' do not match" - only specify assembler options at LTO link time
ifeq ($(strip $(LTO_ENABLE)), yes)
LDFLAGS += -Wa,-adhlns=$(BUILD_DIR)/$(TARGET).lst
else
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
ifeq ($(strip $(DEBUG_ENABLE)),yes)
ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
else
ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
endif
endif
endif
# Define programs and commands. # Define programs and commands.
SHELL = sh SHELL = sh
REMOVE = rm -f REMOVE = rm -f