diff options
| author | Joel Challis <git@zvecr.com> | 2021-11-12 07:31:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-12 18:31:40 +1100 |
| commit | f3fa56c32a240012c7b8c13be10d0b787d849ff3 (patch) | |
| tree | 0845171555b0acaae5298c54c3f0dfd3c287768e /tmk_core | |
| parent | 479950ca3fa484fd14f200306679674f64af824a (diff) | |
| download | qmk_firmware-f3fa56c32a240012c7b8c13be10d0b787d849ff3.tar.gz qmk_firmware-f3fa56c32a240012c7b8c13be10d0b787d849ff3.zip | |
gcc10 LTO - Only specify adhlns assembler options at link time (#15115)
* gcc10 LTO - Only specify adhlns assembler options at link time
* Default adhlns off?
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/rules.mk | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 70ab0eb16..e657af3f4 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk | |||
| @@ -81,7 +81,6 @@ endif | |||
| 81 | # -f...: tuning, see GCC manual and avr-libc documentation | 81 | # -f...: tuning, see GCC manual and avr-libc documentation |
| 82 | # -Wall...: warning level | 82 | # -Wall...: warning level |
| 83 | # -Wa,...: tell GCC to pass this to the assembler. | 83 | # -Wa,...: tell GCC to pass this to the assembler. |
| 84 | # -adhlns...: create assembler listing | ||
| 85 | ifeq ($(strip $(LTO_ENABLE)), yes) | 84 | ifeq ($(strip $(LTO_ENABLE)), yes) |
| 86 | ifeq ($(PLATFORM),CHIBIOS) | 85 | ifeq ($(PLATFORM),CHIBIOS) |
| 87 | $(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.) | 86 | $(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.) |
| @@ -117,10 +116,6 @@ endif | |||
| 117 | #CFLAGS += -Wundef | 116 | #CFLAGS += -Wundef |
| 118 | #CFLAGS += -Wunreachable-code | 117 | #CFLAGS += -Wunreachable-code |
| 119 | #CFLAGS += -Wsign-compare | 118 | #CFLAGS += -Wsign-compare |
| 120 | GCC_VERSION := $(shell gcc --version 2>/dev/null) | ||
| 121 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
| 122 | CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) | ||
| 123 | endif | ||
| 124 | CFLAGS += $(CSTANDARD) | 119 | CFLAGS += $(CSTANDARD) |
| 125 | 120 | ||
| 126 | # This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION | 121 | # This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION |
| @@ -133,7 +128,6 @@ CFLAGS += -fcommon | |||
| 133 | # -f...: tuning, see GCC manual and avr-libc documentation | 128 | # -f...: tuning, see GCC manual and avr-libc documentation |
| 134 | # -Wall...: warning level | 129 | # -Wall...: warning level |
| 135 | # -Wa,...: tell GCC to pass this to the assembler. | 130 | # -Wa,...: tell GCC to pass this to the assembler. |
| 136 | # -adhlns...: create assembler listing | ||
| 137 | ifeq ($(strip $(DEBUG_ENABLE)),yes) | 131 | ifeq ($(strip $(DEBUG_ENABLE)),yes) |
| 138 | CXXFLAGS += -g$(DEBUG) | 132 | CXXFLAGS += -g$(DEBUG) |
| 139 | endif | 133 | endif |
| @@ -152,28 +146,10 @@ endif | |||
| 152 | #CXXFLAGS += -Wstrict-prototypes | 146 | #CXXFLAGS += -Wstrict-prototypes |
| 153 | #CXXFLAGS += -Wunreachable-code | 147 | #CXXFLAGS += -Wunreachable-code |
| 154 | #CXXFLAGS += -Wsign-compare | 148 | #CXXFLAGS += -Wsign-compare |
| 155 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
| 156 | CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) | ||
| 157 | endif | ||
| 158 | #CXXFLAGS += $(CSTANDARD) | 149 | #CXXFLAGS += $(CSTANDARD) |
| 159 | 150 | ||
| 160 | #---------------- Assembler Options ---------------- | 151 | #---------------- Assembler Options ---------------- |
| 161 | # -Wa,...: tell GCC to pass this to the assembler. | ||
| 162 | # -adhlns: create listing | ||
| 163 | # -gstabs: have the assembler create line number information; note that | ||
| 164 | # for use in COFF files, additional information about filenames | ||
| 165 | # and function names needs to be present in the assembler source | ||
| 166 | # files -- see avr-libc docs [FIXME: not yet described there] | ||
| 167 | # -listing-cont-lines: Sets the maximum number of continuation lines of hex | ||
| 168 | # dump that will be displayed for a given single line of source input. | ||
| 169 | ASFLAGS += $(ADEFS) | 152 | ASFLAGS += $(ADEFS) |
| 170 | ifeq ($(findstring clang, ${GCC_VERSION}),) | ||
| 171 | ifeq ($(strip $(DEBUG_ENABLE)),yes) | ||
| 172 | ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 | ||
| 173 | else | ||
| 174 | ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100 | ||
| 175 | endif | ||
| 176 | endif | ||
| 177 | ifeq ($(VERBOSE_AS_CMD),yes) | 153 | ifeq ($(VERBOSE_AS_CMD),yes) |
| 178 | ASFLAGS += -v | 154 | ASFLAGS += -v |
| 179 | endif | 155 | endif |
| @@ -230,6 +206,32 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) | |||
| 230 | # You can give EXTRALDFLAGS at 'make' command line. | 206 | # You can give EXTRALDFLAGS at 'make' command line. |
| 231 | LDFLAGS += $(EXTRALDFLAGS) | 207 | LDFLAGS += $(EXTRALDFLAGS) |
| 232 | 208 | ||
| 209 | #---------------- Assembler Listings ---------------- | ||
| 210 | # -Wa,...: tell GCC to pass this to the assembler. | ||
| 211 | # -adhlns: create listing | ||
| 212 | # -gstabs: have the assembler create line number information; note that | ||
| 213 | # for use in COFF files, additional information about filenames | ||
| 214 | # and function names needs to be present in the assembler source | ||
| 215 | # files -- see avr-libc docs [FIXME: not yet described there] | ||
| 216 | # -listing-cont-lines: Sets the maximum number of continuation lines of hex | ||
| 217 | # dump that will be displayed for a given single line of source input. | ||
| 218 | |||
| 219 | ADHLNS_ENABLE ?= no | ||
| 220 | ifeq ($(ADHLNS_ENABLE),yes) | ||
| 221 | # Avoid "Options to '-Xassembler' do not match" - only specify assembler options at LTO link time | ||
| 222 | ifeq ($(strip $(LTO_ENABLE)), yes) | ||
| 223 | LDFLAGS += -Wa,-adhlns=$(BUILD_DIR)/$(TARGET).lst | ||
| 224 | else | ||
| 225 | CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) | ||
| 226 | CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) | ||
| 227 | ifeq ($(strip $(DEBUG_ENABLE)),yes) | ||
| 228 | ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 | ||
| 229 | else | ||
| 230 | ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100 | ||
| 231 | endif | ||
| 232 | endif | ||
| 233 | endif | ||
| 234 | |||
| 233 | # Define programs and commands. | 235 | # Define programs and commands. |
| 234 | SHELL = sh | 236 | SHELL = sh |
| 235 | REMOVE = rm -f | 237 | REMOVE = rm -f |
