package/mmc-utils: fix build failure with _FORTIFY_SOURCE=3
PATCH 1/1 package/mmc-utils: fix build failure with _FORTIFY_SOURCE=3
At the moment mmc-utils doesn't support _FORTIFY_SOURCE=3 so let's set it to 2 at maximum by undefining _FORTIFY_SOURCE and redefining it to 2.
Fixes:
http://autobuild.buildroot.net/results/32d2f9894efc1e743ca6ae7d2fe3108ccf41c188
--- package/mmc-utils/mmc-utils.mk | 5 +++++ 1 file changed, 5 insertions(+)
package/mmc-utils/mmc-utils.mk +5 -0
@@ -16,6 +16,11 @@ ifeq ($(BR2_PACKAGE_MMC_UTILS_ENABLE_DANGEROUS_COMMANDS),y) MMC_UTILS_CFLAGS += -DDANGEROUS_COMMANDS_ENABLED endif +# disable _FORTIFY_SOURCE=3 and set it to 2 +ifeq ($(BR2_FORTIFY_SOURCE_3),y) +MMC_UTILS_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +endif + # override AM_CFLAGS as the project Makefile uses it to pass # -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2, and the latter conflicts # with the _FORTIFY_SOURCE that we pass when hardening options are
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
package/mmc-utils/mmc-utils.mk ifeq ($(BR2_PACKAGE_MMC_UTILS_ENABLE_DANGEROUS_COMMANDS),y) · line 22
Quoted 4 lines · On Wed, 9 Aug 2023 23:03:38 +0200 Giulio Benetti…
package/mmc-utils/mmc-utils.mk +4
-0+# disable _FORTIFY_SOURCE=3 and set it to 2 +ifeq ($(BR2_FORTIFY_SOURCE_3),y) +MMC_UTILS_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +endif
This is a work-around, not a proper fix, and actually the following defconfig builds just fine today:
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_FORTIFY_SOURCE_3=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_MMC_UTILS=y
# BR2_TARGET_ROOTFS_TAR is not set
So there is really no reason to globally override _FORTIFY_SOURCE=3 for mmc-utils, it builds fine at least in some situations. So it needs to be narrowed down a little bit further, up to the point where we can see if it's a glibc bug, or a gcc bug, possibly architecture specific.
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot