0003-Link-against-libgcc-to-avoid-unresolved-symbols.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From 672eaebd131c789a528e3a9cd089b4b69a82012b Mon Sep 17 00:00:00 2001
  2. From: Guillem Jover <guillem@debian.org>
  3. Date: Fri, 28 Sep 2018 13:15:54 +0300
  4. Subject: [PATCH] Link against libgcc to avoid unresolved symbols
  5. We need to link agaisnt -lgcc, on at least hppa, PPC and ARC.
  6. That's because in some corner-cases like compilation with -Os
  7. on ARC and PPC so-called millicode (basically function prologue and
  8. epilogue) implemented in libgcc.a is used. So we end up with
  9. GLOBAL UNDEFINED symbol in libaio.so and then on linkage of the final
  10. applicaiton LD fails to proceed saying:
  11. --------------------------->8----------------------
  12. hidden symbol '__ld_r13_to_r15_ret' in .../libgcc.a(_millicodethunk_ret.o) is referenced by DSO
  13. --------------------------->8----------------------
  14. Also it looks like in general it is not the best idea to use either
  15. "-nostartfiles" or "-nostdlib" when linking shared libs because
  16. default construtor/destructor functions won't be executed, see
  17. "5.2. Library constructor and destructor functions" in [1]
  18. So let's stop passing "-nostdlib" and "-nostartfiles" and get required
  19. stuff built-in libaio.
  20. Initial patch taken from Debian [2].
  21. Fixes build failures in Buildroot like blktrace [3], lvm2 [4].
  22. Was submitted upstream via pull-request [5].
  23. [1] http://tldp.org/HOWTO/Program-Library-HOWTO/miscellaneous.html
  24. [2] https://sources.debian.org/patches/libaio/0.3.111-1/01_link_libs.patch/
  25. [3] http://autobuild.buildroot.net/results/17461209755038a30118d76acb4f43469a22a139/
  26. [4] http://autobuild.buildroot.net/results/a5dfc87f94b97135e5cc84f6a876114891ed9dd9/
  27. [5] https://pagure.io/libaio/pull-request/7
  28. Signed-off-by: Guillem Jover <guillem@debian.org>
  29. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
  30. ---
  31. src/Makefile | 2 +-
  32. 1 file changed, 1 insertion(+), 1 deletion(-)
  33. diff --git a/src/Makefile b/src/Makefile
  34. index eadb336b47e3..5911c810c766 100644
  35. --- a/src/Makefile
  36. +++ b/src/Makefile
  37. @@ -3,7 +3,7 @@ includedir=$(prefix)/include
  38. libdir=$(prefix)/lib
  39. CFLAGS ?= -g -fomit-frame-pointer -O2
  40. -CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
  41. +CFLAGS += -Wall -I. -fPIC
  42. SO_CFLAGS=-shared $(CFLAGS)
  43. L_CFLAGS=$(CFLAGS)
  44. LINK_FLAGS=
  45. --
  46. 2.17.1