Use CCLINKFLAGS for linking all executables and shared libraries
authorStephane Glondu <steph@glondu.net>
Mon, 22 Jul 2019 11:32:08 +0000 (13:32 +0200)
committerStephane Glondu <steph@glondu.net>
Mon, 22 Jul 2019 12:08:28 +0000 (14:08 +0200)
debian/patches/0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch b/debian/patches/0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch
new file mode 100644 (file)
index 0000000..e399c4d
--- /dev/null
@@ -0,0 +1,45 @@
+From: Torok Edwin <edwin@etorok.net>
+Date: Wed, 15 Jul 2015 16:33:23 +0300
+Subject: Use CCLINKFLAGS for linking all executables and shared libraries
+
+This allows packagers to set additional linker flags for executables and shared
+libraries created by OCaml, and for the OCaml tools themselves.
+OCaml code can be linked with various C stubs and C libraries that would
+benefit from using hardening link flags, such as -Wl,-z,relro.
+
+Origin: other
+Bug-Debian: https://bugs.debian.org/702349
+Forwarded: no
+Last-Update: <2019-07-22>
+---
+ configure.ac   | 3 +++
+ tools/Makefile | 2 +-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 209870e..70bd63f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -768,6 +768,9 @@ AS_IF([test x"$enable_shared" != "xno"],
+       natdynlinkopts="-Wl,-E"
+       shared_libraries_supported=true])])
++mksharedlib="$mksharedlib $CCLINKFLAGS"
++mkexe="$mkexe $CCLINKFLAGS"
++
+ AS_IF([test -z "$mkmaindll"], [mkmaindll=$mksharedlib])
+ # Configure native dynlink
+diff --git a/tools/Makefile b/tools/Makefile
+index ee0e0be..b6d74d5 100644
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -323,7 +323,7 @@ endif
+ objinfo_helper$(EXE): objinfo_helper.c $(ROOTDIR)/runtime/caml/s.h
+       $(CC) $(OC_CFLAGS) $(OC_CPPFLAGS) -I$(ROOTDIR)/runtime $(OUTPUTEXE)$@ \
+-          $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) $< $(LIBBFD_LINK)
++          $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) $< $(LIBBFD_LINK) $(CCLINKFLAGS)
+ OBJINFO=$(ROOTDIR)/compilerlibs/ocamlcommon.cma \
+         $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \
index f14fc52345608dcd5578c1bfaea32de658459f7b..7a628c63650abe62b93bf02a800f3ec44e814904 100644 (file)
@@ -1,3 +1,4 @@
 0003-Don-t-use-rpath.patch
 0004-Put-manpages-in-section-3o-instead-of-3.patch
 0003-Fix-in-configure.am.patch
+0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch