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)
committerRaspbian forward porter <root@raspbian.org>
Sat, 7 Nov 2020 23:17:21 +0000 (23:17 +0000)
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 0003-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch

configure.ac
tools/Makefile

index aa5f26f28001bdb4d0d3f46c8aa65d0dd330d13a..069fe960777fdcc479c37b15ce3391ec18c6c11c 100644 (file)
@@ -831,6 +831,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 dbad0b74f2ab3b8b3df16acaadf78a6cc043c0d9..b4adcffa846e59776410f1609ffd16644e448d43 100644 (file)
@@ -276,7 +276,7 @@ DEF_SYMBOL_PREFIX = '-Dsymbol_prefix="_"'
 endif
 
 objinfo_helper$(EXE): objinfo_helper.$(O)
-       $(CC) $(BFD_LDFLAGS) $(OC_CFLAGS) $(OUTPUTEXE)$@ $< $(BFD_LDLIBS)
+       $(CC) $(BFD_LDFLAGS) $(OC_CFLAGS) $(OUTPUTEXE)$@ $< $(BFD_LDLIBS) $(CCLINKFLAGS)
 
 objinfo_helper.$(O): $(ROOTDIR)/runtime/caml/s.h