Building dmalloc on Microblaze with optimization enabled and gcc < 8.x
fails with:
Error: operation combines symbols in different segments
This is due to gcc bug 63261 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261).
To avoid this, the dmalloc package has a !BR2_microblaze
dependency. However, gcc bug 63261 only triggers when optimization is
enabled, so we can work around the issue by passing -O0, which is what
we do in other Buildroot packages to work around this bug.
So, this commit passes -O0 when BR2_TOOLCHAIN_HAS_GCC_BUG_63261, and
re-enables dmalloc on Microblaze.
Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
config BR2_PACKAGE_DMALLOC
bool "dmalloc"
- # On some packages, Microblaze gcc has issues when debugging
- # symbols are enabled: "Error: operation combines symbols in
- # different segments".
- depends on !(BR2_microblaze && BR2_ENABLE_DEBUG)
help
A debug memory allocation library which is a drop in
replacement for the system's malloc, realloc, calloc, free and
DMALLOC_CFLAGS += -marm
endif
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_63261),y)
+DMALLOC_CFLAGS += -O0
+endif
+
DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
define DMALLOC_POST_PATCH