lvm2-2.03.05-dynamic-static-ldflags.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 93101699f5e1190184c00c99ab7b6e9717e5019a Mon Sep 17 00:00:00 2001
  2. From: "Robin H. Johnson" <robbat2@gentoo.org>
  3. Date: Wed, 24 Jul 2019 11:11:35 +0200
  4. Subject: [PATCH] Add dynamic static ldflags
  5. Forward-ported from 2.02.178 to 2.03.05
  6. Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
  7. ---
  8. configure.ac | 2 ++
  9. daemons/dmeventd/Makefile.in | 2 +-
  10. make.tmpl.in | 1 +
  11. tools/Makefile.in | 2 +-
  12. 4 files changed, 5 insertions(+), 2 deletions(-)
  13. diff --git a/configure.ac b/configure.ac
  14. index 1e45c0edcb..cc2625294a 100644
  15. --- a/configure.ac
  16. +++ b/configure.ac
  17. @@ -33,6 +33,7 @@ case "$host_os" in
  18. CLDFLAGS="${CLDFLAGS:"$LDFLAGS"} -Wl,--version-script,.export.sym"
  19. # equivalent to -rdynamic
  20. ELDFLAGS="-Wl,--export-dynamic"
  21. + STATIC_LDFLAGS="-Wl,--no-export-dynamic"
  22. # FIXME Generate list and use --dynamic-list=.dlopen.sym
  23. CLDWHOLEARCHIVE="-Wl,-whole-archive"
  24. CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
  25. @@ -1758,6 +1759,7 @@ AC_SUBST(SYSCONFDIR)
  26. AC_SUBST(SYSTEMD_LIBS)
  27. AC_SUBST(SNAPSHOTS)
  28. AC_SUBST(STATICDIR)
  29. +AC_SUBST(STATIC_LDFLAGS)
  30. AC_SUBST(STATIC_LINK)
  31. AC_SUBST(TESTSUITE_DATA)
  32. AC_SUBST(THIN)
  33. diff --git a/daemons/dmeventd/Makefile.in b/daemons/dmeventd/Makefile.in
  34. index 6bd36d0325..a3c30ec1a0 100644
  35. --- a/daemons/dmeventd/Makefile.in
  36. +++ b/daemons/dmeventd/Makefile.in
  37. @@ -66,7 +66,7 @@ dmeventd: $(LIB_SHARED) dmeventd.o
  38. dmeventd.static: $(LIB_STATIC) dmeventd.o
  39. @echo " [CC] $@"
  40. - $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) dmeventd.o \
  41. + $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) dmeventd.o \
  42. -o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS) $(STATIC_LIBS)
  43. ifeq ("@PKGCONFIG@", "yes")
  44. diff --git a/make.tmpl.in b/make.tmpl.in
  45. index f3332e91c1..1489c2afad 100644
  46. --- a/make.tmpl.in
  47. +++ b/make.tmpl.in
  48. @@ -68,6 +68,7 @@ DEFS += @DEFS@
  49. # FIXME set this only where it's needed, not globally?
  50. CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
  51. LDFLAGS ?= @LDFLAGS@
  52. +STATIC_LDFLAGS += @STATIC_LDFLAGS@
  53. CLDFLAGS += @CLDFLAGS@
  54. ELDFLAGS += @ELDFLAGS@
  55. LDDEPS += @LDDEPS@
  56. diff --git a/tools/Makefile.in b/tools/Makefile.in
  57. index 2620daa17c..e5fc9c4ae4 100644
  58. --- a/tools/Makefile.in
  59. +++ b/tools/Makefile.in
  60. @@ -136,7 +136,7 @@ man-generator: man-generator.o
  61. lvm.static: $(OBJECTS) lvm-static.o $(LVMINTERNAL_LIBS)
  62. @echo " [CC] $@"
  63. - $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ $+ \
  64. + $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) -o $@ $+ \
  65. $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS)
  66. liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
  67. --
  68. 2.22.0