busybox: fix LTO compiler flags
authorFelix Fietkau <nbd@nbd.name>
Sat, 28 Dec 2024 21:46:19 +0000 (22:46 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sat, 28 Dec 2024 21:50:04 +0000 (22:50 +0100)
When doing LTO builds, the target related CFLAGS need to be passed to the
linker, so that they are considered for target code generation.
Pass TARGET_CFLAGS in EXTRA_LDFLAGS to ensure that this is handled properly.

Fixes: #17200
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit e6ce868c3a6f843f2c14498d0174011c8713a8bd)

package/utils/busybox/Makefile

index 4ef470df75589060d9871dc8c5c96a0d8fb70f53..7d302bd159f09f716b0745287516fa3318996b59 100644 (file)
@@ -111,7 +111,7 @@ endif
 MAKE_VARS :=
 MAKE_FLAGS += \
        EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
-       EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
+       EXTRA_LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_CFLAGS)" \
        LDLIBS="$(LDLIBS)" \
        LD="$(TARGET_CC)" \
        SKIP_STRIP=y