Use CCLINKFLAGS for linking all executables and shared libraries
authorTorok Edwin <edwin@etorok.net>
Wed, 15 Jul 2015 13:33:23 +0000 (16:33 +0300)
committerStéphane Glondu <glondu@debian.org>
Mon, 4 Nov 2019 12:43:40 +0000 (13:43 +0100)
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>

Gbp-Pq: Name 0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch

configure.ac
tools/Makefile

index f5d8a2687bca02820be49069b7ee37ce791fc2a4..82172d769c19368d908c2d84ef4c0fc9f142c7df 100644 (file)
@@ -767,6 +767,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
index ee0e0be4c9ae80adb26f78a60764c7a7da01758f..b6d74d517c825ef91354abe2a6cbed937365c3bc 100644 (file)
@@ -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 \