diff options
| author | Angus Gratton <angus@redyak.com.au> | 2022-07-15 15:13:42 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-07-18 16:12:08 +1000 |
| commit | 1d23c01dd6d2bcf64dec86ceed77db7ecac8a8d9 (patch) | |
| tree | 1869dd0983c75681f941d8e325f3b9432adc08b2 | |
| parent | a1ef5ac65db8c7509bef5d3db9ba6de9fbb4ef40 (diff) | |
stm32/Makefile: Workaround LTO linker order bug in binutils <2.35.
Assembly files with weak symbols need to be linked first to avoid issues
with the weak symbols being incorrectly linked instead of strong ones.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83967 and
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
This is the workaround suggested in comment 10 of the gcc-arm-embedded bug.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
| -rw-r--r-- | ports/stm32/Makefile | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index f1c22c2a9..bab62eaae 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -534,6 +534,9 @@ endif endif +# SRC_O should be placed first to work around this LTO bug with binutils <2.35: +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83967 +OBJ += $(addprefix $(BUILD)/, $(SRC_O)) OBJ += $(PY_O) OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o)) OBJ += $(LIBM_O) @@ -544,7 +547,6 @@ OBJ += $(addprefix $(BUILD)/, $(HAL_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(USBDEV_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o)) -OBJ += $(addprefix $(BUILD)/, $(SRC_O)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) OBJ += $(BUILD)/pins_$(BOARD).o |
