libaio: Make sure symbols from libgcc.a get defined in libaio.so for ARC & PPC
PATCH v2 1/1 libaio: Make sure symbols from libgcc.a get defined in libaio.so for ARC & PPC
On ARC and PowerPC if "-Os" optimization is used compiler prefers to use so-called millicode (basically function prologue & epilogue) implemented once and for all in libgcc.a. And if we don't link with libgcc.a on DSO (read libaio.so) creation those millicode functions won't be included, instead their symbols will be referenced as they were in libgcc (HIDDEN).
And then when LD is about to link a final application it sees HIDDEN symbol in libaio.so that is supposed to come from some static libgcc.a... wait.. what? Shared library has unresolved symbol implemented in static library? No, that's not right I guess :)
So to resolve that wrong sequence we just make sure libaio.so has its own copy of used millicode functions implemented locally.
Fixes: http://autobuild.buildroot.net/?reason=blktrace-1.2.0&arch=arc
Improves: https://git.buildroot.org/buildroot/commit/?id=ce6536ae500fc4ac0c201d5cb4edf39dd1b4d386
---
Changes v1 -> v2:
* Apply the same fix for PowerPC
package/libaio/libaio.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
package/libaio/libaio.mk +6 -4
@@ -16,10 +16,12 @@ ifeq ($(BR2_STATIC_LIBS),y) LIBAIO_CONFIGURE_OPTS += ENABLE_SHARED=0 endif -# On PowerPC, a weird toolchain issue causes -Os builds to produce -# references to hidden symbols, so we're forcing -O2 -ifeq ($(BR2_powerpc),y) -LIBAIO_CONFIGURE_OPTS += CFLAGS="$(subst -Os,-O2,$(TARGET_CFLAGS))" +# ARC and PowerPC in case of compilation with "-Os" +# rely on some functions implemented in libgcc.a +# and we need to make sure all functions from libgcc.a +# get included in libaio.so +ifeq ($(BR2_arc)$(BR2_powerpc),y) +LIBAIO_CONFIGURE_OPTS += LDFLAGS=-lgcc endif define LIBAIO_BUILD_CMDS
Signature · 1 line
2.16.2