From 9f6977d22da4b1367f6990a980d834db33daba7c Mon Sep 17 00:00:00 2001 From: Cristiano Giuffrida Date: Tue, 17 Jun 2014 13:47:07 +0200 Subject: [PATCH] llvm: Split BITCODE_LD_FLAGS Split across the two linking steps for instrumentation purposes. --- minix/llvm/relink.llvm | 2 +- share/mk/bsd.own.mk | 6 ++++-- share/mk/bsd.prog.mk | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/minix/llvm/relink.llvm b/minix/llvm/relink.llvm index 060c9941d..3ccf919e0 100755 --- a/minix/llvm/relink.llvm +++ b/minix/llvm/relink.llvm @@ -126,7 +126,7 @@ do clean_module $n $m "relink" if [ "${STATIC_LIBS}"!="" ]; then STATIC_LIBS=`echo ${STATIC_LIBS} | sed -e "s/\ /\\\ /g"` - LDFLAGS_PLACEHOLDER="BITCODE_LD_FLAGS.$n=${STATIC_LIBS}" + LDFLAGS_PLACEHOLDER="BITCODE_LD_FLAGS_1ST.$n=${STATIC_LIBS}" fi env "`echo ${LDFLAGS_PLACEHOLDER}`" MKBITCODE=yes \ diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 4de947a63..92e8cb0da 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -74,11 +74,13 @@ OPTFLAGS?= -disable-opt \ # Whitout -Wl,--no-ctors-in-init-array, golds moves the constructors out of # .ctors into .init_array, which is bad on intel. -BITCODE_LD_FLAGS?= \ +BITCODE_LD_FLAGS_1ST?= \ -Wl,--no-ctors-in-init-array \ -Wl,-plugin=${GOLD_PLUGIN} \ -Wl,-plugin-opt=-disable-opt \ - -Wl,-plugin-opt=-disable-inlining \ + -Wl,-plugin-opt=-disable-inlining + +BITCODE_LD_FLAGS_2ND?=${BITCODE_LD_FLAGS_1ST} .ifdef CONFIG_SMP SMP_FLAGS += -DCONFIG_SMP diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 370793137..3c50ff598 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -580,7 +580,8 @@ ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS} CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o OPTFLAGS.${_P}?= ${OPTFLAGS} -BITCODE_LD_FLAGS.${_P}+= ${BITCODE_LD_FLAGS} +BITCODE_LD_FLAGS_1ST.${_P}+= ${BITCODE_LD_FLAGS_1ST} +BITCODE_LD_FLAGS_2ND.${_P}+= ${BITCODE_LD_FLAGS_2ND} ${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ ${LIBCRTEND} ${_DPADD.${_P}} @@ -592,7 +593,7 @@ ${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ ${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \ ${_LDSTATIC.${_P}} ${_PROGLDOPTS} \ -Wl,-r \ - ${BITCODE_LD_FLAGS.${_P}} \ + ${BITCODE_LD_FLAGS_1ST.${_P}} \ -Wl,-plugin-opt=emit-llvm ${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS} @@ -611,7 +612,7 @@ ${_P}: ${_P}.bcl.o -L${DESTDIR}/usr/lib \ ${_LDSTATIC.${_P}} -o ${.TARGET} \ ${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \ - ${BITCODE_LD_FLAGS.${_P}} \ + ${BITCODE_LD_FLAGS_2ND.${_P}} \ -Wl,--allow-multiple-definition .endif # !commands(${_P}) -- 2.44.0