LLVM Minix changes
- import libcxx - reduce targets to the one when compiled as a tools Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
This commit is contained in:
+30
-18
@@ -203,19 +203,20 @@ LIBSTRIPSHLIBOBJS= yes
|
||||
.endif
|
||||
|
||||
.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
|
||||
|
||||
SHLIB_SHFLAGS+= ${${HAVE_GOLD:Uno} != "no":? -Wl,--script,${LDS_SHARED_LIB}:}
|
||||
SHLIB_SHFLAGS+= -L ${DESTDIR}/usr/lib
|
||||
SHLIB_SHFLAGS+= -Wl,-plugin=${GOLD_PLUGIN} \
|
||||
-Wl,-plugin-opt=-disable-opt
|
||||
|
||||
.S.bc: ${.TARGET:.bc=.o}
|
||||
rm -f ${.TARGET}
|
||||
ln ${.TARGET:.bc=.o} ${.TARGET}
|
||||
.c.bc:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o - \
|
||||
-Qunused-arguments -E -D"__weak_alias(X, Y)=__weak_alias2( __WEAK__ ## X, __WEAK__ ## Y)" \
|
||||
| sed 's/__WEAK__//g' \
|
||||
| ${COMPILE.c} -flto ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -x c - \
|
||||
-o ${.TARGET} -D"STRINGIFY(a)=#a" -D"__weak_alias2(X, Y)=_Pragma(STRINGIFY(weak X = Y))"
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto
|
||||
|
||||
.cc.bc .cxx.bc .cpp.bc:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto
|
||||
.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
|
||||
.c.o:
|
||||
${_MKTARGET_COMPILE}
|
||||
@@ -549,7 +550,11 @@ _INSTRANLIB=
|
||||
.else
|
||||
_ARFL=crs
|
||||
_ARRANFL=s
|
||||
.if ${USE_BITCODE:Uno} == "yes"
|
||||
_INSTRANLIB=${empty(PRESERVE):?-a "${AR} --plugin ${GOLD_PLUGIN} -s":}
|
||||
.else
|
||||
_INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
|
||||
.endif # ${USE_BITCODE:Uno} == "yes"
|
||||
.endif
|
||||
|
||||
# If you change this, please consider reflecting the change in
|
||||
@@ -578,11 +583,20 @@ CLEANFILES+= ${_YLSRCS}
|
||||
${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
|
||||
|
||||
.if ${USE_BITCODE:Uno} == "yes"
|
||||
BCOBJS+=${OBJS:.o=.bc}
|
||||
${LIB_bc.a}:: ${BCOBJS}
|
||||
|
||||
.if !target(__archivebuildbc)
|
||||
__archivebuildbc: .USE
|
||||
${_MKTARGET_BUILD}
|
||||
rm -f ${.TARGET}
|
||||
${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*bc} | ${TSORT}`
|
||||
${AR} ${_ARFL} --plugin ${GOLD_PLUGIN} ${.TARGET} ${.ALLSRC:M*bc}
|
||||
.endif
|
||||
|
||||
# LSC: Ignore libunwind in the bitcode archive, otherwise final linking chokes
|
||||
# on libunwind hidden assembly symbols.
|
||||
BCOBJS+=${OBJS:Nlibunwind.*:.o=.bc}
|
||||
ALLOBJS+=${BCOBJS}
|
||||
${_LIB_bc.a}:: ${BCOBJS} __archivebuildbc
|
||||
|
||||
.endif # ${USE_BITCODE:Uno} == "yes"
|
||||
|
||||
${_LIB.a}:: ${STOBJS} __archivebuild
|
||||
@@ -625,7 +639,6 @@ LDLIBC ?= -nodefaultlibs
|
||||
LDADD+= -lgcc
|
||||
.else
|
||||
LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc:}
|
||||
LDADD+= ${${ACTIVE_CC} == "clang":?-lCompilerRT-Generic:}
|
||||
.if ${MACHINE_ARCH} == "earm"
|
||||
LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:}
|
||||
.endif # ${MACHINE_ARCH} == "earm"
|
||||
@@ -656,7 +669,6 @@ ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPLIBC} \
|
||||
rm -f ${.TARGET}
|
||||
${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \
|
||||
${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \
|
||||
${${USE_BITCODE:Uno} == "yes":? -Wl,-plugin=/usr/pkg/lib/bfd-plugins/LLVMgold.so -Wl,-plugin-opt=-disable-opt:} \
|
||||
-Wl,--whole-archive ${SOLIB} \
|
||||
-Wl,--no-whole-archive ${_LDADD.${_LIB}}
|
||||
# We don't use INSTALL_SYMLINK here because this is just
|
||||
@@ -741,19 +753,19 @@ LIBCLEANFILES6+= ${_LIB_bc.a} ${BCOBJS} ${BCOBJS:=.tmp}
|
||||
libinstall::
|
||||
|
||||
.if ${USE_BITCODE:Uno} == "yes"
|
||||
libinstall:: ${_DEST.LIB}/bc/${_LIB_bc.a}
|
||||
.PRECIOUS: ${_DEST.LIB}/bc/${_LIB_bc.a}
|
||||
libinstall:: ${_DEST.LIB}/bc/${_LIB.a}
|
||||
.PRECIOUS: ${_DEST.LIB}/bc/${_LIB.a}
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a})
|
||||
${_DEST.LIB}/bc/${_LIB_bc.a}! .MADE
|
||||
${_DEST.LIB}/bc/${_LIB.a}! .MADE
|
||||
.endif
|
||||
${_DEST.LIB}/bc/${_LIB_bc.a}! ${_LIB_bc.a} __archiveinstall
|
||||
${_DEST.LIB}/bc/${_LIB.a}! ${_LIB_bc.a} __archiveinstall
|
||||
.else
|
||||
.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a})
|
||||
${_DEST.LIB}/bc/${_LIB_bc.a}: .MADE
|
||||
${_DEST.LIB}/bc/${_LIB.a}: .MADE
|
||||
.endif
|
||||
${_DEST.LIB}/bc/${_LIB_bc.a}: ${_LIB_bc.a} __archiveinstall
|
||||
${_DEST.LIB}/bc/${_LIB.a}: ${_LIB_bc.a} __archiveinstall
|
||||
.endif
|
||||
.endif # ${USE_BITCODE:Uno} == "yes"
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ _BSD_LUA_MK_=1
|
||||
.include <bsd.shlib.mk>
|
||||
.include <bsd.gcc.mk>
|
||||
|
||||
.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
|
||||
LDFLAGS+= -L${DESTDIR}/usr/lib
|
||||
.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
|
||||
|
||||
##
|
||||
##### Basic targets
|
||||
realinstall: .PHONY lua-install
|
||||
|
||||
+96
-59
@@ -29,7 +29,6 @@ MKMCLINKER?= no
|
||||
MKCLANGRT?= no
|
||||
MKGCC?= no
|
||||
MKGCCCMDS?= no
|
||||
MKLIBSTDCXX?= no
|
||||
MKPROFILE?= no
|
||||
MKSLJIT?= no
|
||||
|
||||
@@ -62,6 +61,24 @@ MKRUMP:= no
|
||||
MKSKEY:= no
|
||||
MKYP:= no
|
||||
|
||||
WEAKALIASOVERRIDEPASS?=${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/WeakAliasModuleOverride.so
|
||||
GOLD_PLUGIN?=${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/LLVMgold.so
|
||||
|
||||
# By default when running LLVM passes:
|
||||
# - do not run optimization while running LLVM passes
|
||||
# - run the passe which allows assembly weak symbols to be
|
||||
# overriden by bitcode functions
|
||||
OPTFLAGS?= -disable-opt \
|
||||
-load ${WEAKALIASOVERRIDEPASS} -weak-alias-module-override
|
||||
|
||||
# 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?= \
|
||||
-Wl,--no-ctors-in-init-array \
|
||||
-Wl,-plugin=${GOLD_PLUGIN} \
|
||||
-Wl,-plugin-opt=-disable-opt \
|
||||
-Wl,-plugin-opt=-disable-inlining \
|
||||
|
||||
.ifdef CONFIG_SMP
|
||||
SMP_FLAGS += -DCONFIG_SMP
|
||||
.ifdef CONFIG_MAX_CPUS
|
||||
@@ -85,28 +102,12 @@ USETOOLS?= never
|
||||
. endif
|
||||
. endif # ${_HAVE_LLVM:U} == ""
|
||||
|
||||
. if ${_HAVE_GOLD:U} == ""
|
||||
_HAVE_GOLD!= (exec 2>&1; ld --version || echo "")
|
||||
_GOLD_MATCH:=${_HAVE_GOLD:Mgold}
|
||||
_HAVE_GOLD:= ${_HAVE_GOLD:M[0-9]\.[0-9][0-9]}
|
||||
. if ${_GOLD_MATCH} != "" && ${_HAVE_GOLD} != ""
|
||||
HAVE_GOLD?= ${_HAVE_GOLD}
|
||||
CFLAGS+= -DHAVE_GOLD=${_HAVE_GOLD}
|
||||
AFLAGS+= -DHAVE_GOLD=${_HAVE_GOLD}
|
||||
. else
|
||||
MKBITCODE:=no
|
||||
. endif
|
||||
. endif # ${_HAVE_GOLD:U} == ""
|
||||
|
||||
# If DESTDIR was specified, and we are not using the tools, then make sure to
|
||||
# build out-of-tree and to refer only DESTDIR for target binaries
|
||||
# The case when using tools is already handled below.
|
||||
. if ${DESTDIR:U} != ""
|
||||
CPPFLAGS+= --sysroot=${DESTDIR}
|
||||
LDFLAGS+= --sysroot=${DESTDIR}
|
||||
. if defined(HAVE_LLVM)
|
||||
LDFLAGS+= -L${DESTDIR}/usr/lib
|
||||
. endif
|
||||
. endif # ${DESTDIR:U} != ""
|
||||
|
||||
MKTOOLS?=no
|
||||
@@ -125,61 +126,60 @@ USETOOLS?= never
|
||||
. endif # !defined(HOSTPROG) && !defined(HOSTLIB)
|
||||
.endif # __uname_s == "Minix"
|
||||
|
||||
.if ${MKKYUA:Uno} == "yes" || ${MKATF:Uyes} == "yes"
|
||||
. if ${MKLIBCXX:Uno} == "no" && ${HAVE_GCC:Dyes} != "yes"
|
||||
# No libc++ available, so we have to fallback on libstdc++.
|
||||
# This implies that the compiler is GCC on a native system, or we are building
|
||||
# GCC.
|
||||
# If HAVE_GCC is not defined, then it is a crossbuild, and we have to build
|
||||
# LIBSTDC++, otherwise we will simply use the system one.
|
||||
MKLIBSTDCXX:= yes # required for Kyua / ATF
|
||||
. endif # ${MKLIBCXX:Uno} == "no" && ${HAVE_GCC:Dyes} != "yes"
|
||||
.if ${HAVE_GCC:Dyes} == "yes" || \
|
||||
(${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no")
|
||||
# We are building with GCC, means we cannot build LIBCXX, and need LIBSTDCXX
|
||||
MKLIBCXX?= no # Can't compile with GCC.
|
||||
|
||||
# If we need LIBSTDC++, then we are using the in-tree GCC.
|
||||
. if ${MKLIBSTDCXX} == "yes"
|
||||
. if ${USETOOLS:Uno} == "yes" || ${MKLIBSTDCXX:Uno} == "yes"
|
||||
# When cross-compiling, or building MKLIBSTDCXX, use the in-tree LIBSTDCXX
|
||||
MKLIBSTDCXX?= yes
|
||||
CXXFLAGS+= -I${DESTDIR}/usr/include/g++
|
||||
MKGCCCMDS:= yes
|
||||
. endif # ${MKLIBSTDCXX} == "yes"
|
||||
. endif # ${USETOOLS:Uno} == "yes"
|
||||
|
||||
. if ${HAVE_GCC:Dyes} == "yes" && ${MKLIBCXX:Uno} != "yes"
|
||||
# Specify the C++ system header for libstdc++
|
||||
. if ${MKLIBSTDCXX:Uno} == "no"
|
||||
# Specify the C++ system header for the host libstdc++, as we are not building
|
||||
# LIBSTDCXX
|
||||
CXXFLAGS+= -I/usr/include/g++
|
||||
. endif # ${HAVE_GCC:Dyes} == "yes" && ${MKLIBCXX:Uno} != "yes"
|
||||
.endif # ${MKKYUA:Uno} == "yes" || ${MKATF:Uyes} == "yes"
|
||||
. endif # ${MKLIBSTDCXX:Uno} == "no"
|
||||
|
||||
.if ${MKLLVM:Uno} == "yes"
|
||||
HAVE_LLVM?=34 # The in-tree LLVM version 3.4
|
||||
MKBINUTILS?= yes # We are installing clang, so trigger binutils.
|
||||
.endif # ${MKLLVM:Uno} == "yes"
|
||||
.endif # ${HAVE_GCC:Dyes} == "yes" || \
|
||||
# (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no")
|
||||
|
||||
# MKGCCCMDS == yes implies MKGCC == yes
|
||||
.if ${MKGCCCMDS} == "yes"
|
||||
MKGCC:= yes
|
||||
MKGCC= yes
|
||||
MKBINUTILS?= yes # We are installing GCC, so trigger binutils.
|
||||
MKLIBSTDCXX?= yes # Also install the GNU C++ library
|
||||
.endif # ${MKGCCCMDS} == "yes"
|
||||
|
||||
# The default value of MKLIBSTDCXX cannot be set before the previous test.
|
||||
MKLIBSTDCXX?= no
|
||||
|
||||
.if ${MKGCC} == "yes"
|
||||
HAVE_GCC?= 45 # The in-tree gcc version is 4.5
|
||||
.endif # ${MKGCC} == "yes"
|
||||
|
||||
.if ${USETOOLS:Uno} == "yes"
|
||||
MKLLVM?= yes
|
||||
.endif # ${USETOOLS:Uno} == "yes"
|
||||
|
||||
.if ${MKLLVM:Uno} == "yes"
|
||||
HAVE_LLVM?= 34 # The in-tree LLVM version is 3.4
|
||||
MKBINUTILS?= yes # We are installing clang, so trigger binutils.
|
||||
.endif # ${MKLLVM:Uno} == "yes"
|
||||
|
||||
.if ${HAVE_LLVM:Dyes} == "yes"
|
||||
HAVE_LIBGCC?= no
|
||||
.endif # ${HAVE_LLVM:Dyes} == "yes"
|
||||
|
||||
# The default value has to be set after we have figured out if we are using GCC
|
||||
# or not.
|
||||
MKLIBCXX?= yes # Build by default libc++
|
||||
|
||||
# The default value of MKBINUTILS cannot be set before the previous test.
|
||||
MKBINUTILS?= no
|
||||
|
||||
.if ${MKGCC} == "yes"
|
||||
HAVE_GCC:= 45 # The in-tree gcc version is 4.5
|
||||
.endif # ${MKGCC} == "yes"
|
||||
|
||||
#
|
||||
# linker script files that have to be specified explicitely for the gold linker
|
||||
#
|
||||
|
||||
LDS_PATH= ${NETBSDSRCDIR}/external/gpl3/binutils/ldscripts
|
||||
LDS_STATIC_BIN= ${LDS_PATH}/elf_${MACHINE_ARCH}_minix.xc
|
||||
LDS_DYNAMIC_BIN= ${LDS_PATH}/elf_${MACHINE_ARCH}_minix.xc
|
||||
LDS_RELOC= ${LDS_PATH}/elf_${MACHINE_ARCH}_minix.xr
|
||||
LDS_SHARED_LIB= ${LDS_PATH}/elf_${MACHINE_ARCH}_minix.xsc
|
||||
LDS_N= ${LDS_PATH}/elf_${MACHINE_ARCH}_minix.xbn
|
||||
|
||||
#LSC FIXME: Needed by clang for now
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
CPUFLAGS+= -march=i586
|
||||
.endif
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
MAKECONF?= /etc/mk.conf
|
||||
@@ -386,6 +386,8 @@ TOOL_CC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang
|
||||
TOOL_CPP.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp
|
||||
TOOL_CXX.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang++
|
||||
TOOL_OBJC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang
|
||||
TOOL_OPT.clang= ${EXTERNAL_TOOLCHAIN}/bin/opt
|
||||
TOOL_LLC.clang= ${EXTERNAL_TOOLCHAIN}/bin/llc
|
||||
.else # } {
|
||||
# Define default locations for common tools.
|
||||
.if ${USETOOLS_BINUTILS:Uyes} == "yes" # {
|
||||
@@ -412,6 +414,8 @@ TOOL_CC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
|
||||
TOOL_CPP.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp
|
||||
TOOL_CXX.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++
|
||||
TOOL_OBJC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
|
||||
TOOL_OPT.clang= ${TOOLDIR}/bin/opt
|
||||
TOOL_LLC.clang= ${TOOLDIR}/bin/llc
|
||||
|
||||
# PCC supports C and Fortran
|
||||
TOOL_CC.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc
|
||||
@@ -542,6 +546,8 @@ TOOL_CC.clang= clang
|
||||
TOOL_CPP.clang= clang-cpp
|
||||
TOOL_CXX.clang= clang++
|
||||
TOOL_OBJC.clang= clang
|
||||
TOOL_OPT.clang= opt
|
||||
TOOL_LLC.clang= llc
|
||||
|
||||
# GCC supports C, C++, Fortran and Objective C
|
||||
TOOL_CC.gcc= gcc
|
||||
@@ -562,7 +568,13 @@ TOOL_AWK= awk
|
||||
TOOL_CAP_MKDB= cap_mkdb
|
||||
TOOL_CAT= cat
|
||||
TOOL_CKSUM= cksum
|
||||
.if defined(__MINIX)
|
||||
# LSC: A full path has to be provided, as this is also, used as a make
|
||||
# target.
|
||||
TOOL_CLANG_TBLGEN= /usr/bin/clang-tblgen
|
||||
.else
|
||||
TOOL_CLANG_TBLGEN= clang-tblgen
|
||||
.endif # defined(__MINIX)
|
||||
TOOL_COMPILE_ET= compile_et
|
||||
TOOL_CONFIG= config
|
||||
TOOL_CRUNCHGEN= crunchgen
|
||||
@@ -586,7 +598,13 @@ TOOL_INDXBIB= indxbib
|
||||
TOOL_INSTALLBOOT= installboot
|
||||
TOOL_INSTALL_INFO= install-info
|
||||
TOOL_JOIN= join
|
||||
.if defined(__MINIX)
|
||||
# LSC: A full path has to be provided, as this is also, used as a make
|
||||
# target.
|
||||
TOOL_LLVM_TBLGEN= /usr/bin/llvm-tblgen
|
||||
.else
|
||||
TOOL_LLVM_TBLGEN= llvm-tblgen
|
||||
.endif # defined(__MINIX)
|
||||
TOOL_M4= m4
|
||||
TOOL_MACPPCFIXCOFF= macppc-fixcoff
|
||||
TOOL_MAKEFS= makefs
|
||||
@@ -645,10 +663,12 @@ TOOL_CPP.false= false
|
||||
TOOL_CXX.false= false
|
||||
TOOL_FC.false= false
|
||||
TOOL_OBJC.false= false
|
||||
TOOL_OPT.false= false
|
||||
TOOL_LLC.false= false
|
||||
|
||||
AVAILABLE_COMPILER?= ${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} false
|
||||
|
||||
.for _t in CC CPP CXX FC OBJC
|
||||
.for _t in CC CPP CXX FC OBJC OPT LLC
|
||||
ACTIVE_${_t}= ${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]}
|
||||
SUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@}
|
||||
.endfor
|
||||
@@ -658,6 +678,8 @@ CPP= ${TOOL_CPP.${ACTIVE_CPP}}
|
||||
CXX= ${TOOL_CXX.${ACTIVE_CXX}}
|
||||
FC= ${TOOL_FC.${ACTIVE_FC}}
|
||||
OBJC= ${TOOL_OBJC.${ACTIVE_OBJC}}
|
||||
OPT= ${TOOL_OPT.${ACTIVE_OPT}}
|
||||
LLC= ${TOOL_LLC.${ACTIVE_LLC}}
|
||||
|
||||
.if exists(/usr/bin/${TOOL_CTFCONVERT}) || exists(${TOOL_CTFCONVERT})
|
||||
CTFCONVERT= ${TOOL_CTFCONVERT}
|
||||
@@ -900,6 +922,7 @@ GCC_CONFIG_ARCH.earm=armv7-a
|
||||
# MINIX/intel default
|
||||
GNU_ARCH.i386=i586
|
||||
GCC_CONFIG_ARCH.i386=i586
|
||||
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
|
||||
@@ -926,6 +949,20 @@ MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd
|
||||
.if defined(__MINIX)
|
||||
# We have a simpler toolchain naming scheme
|
||||
MACHINE_GNU_PLATFORM:=${MACHINE_GNU_ARCH}-elf32-minix
|
||||
|
||||
# We need to check for HAVE_GOLD after LD has been set
|
||||
.if ${_HAVE_GOLD:U} == ""
|
||||
_HAVE_GOLD!= (exec 2>&1; ${LD} --version || echo "")
|
||||
_GOLD_MATCH:=${_HAVE_GOLD:Mgold}
|
||||
_HAVE_GOLD:= ${_HAVE_GOLD:M[0-9]\.[0-9][0-9]}
|
||||
. if ${_GOLD_MATCH} != "" && ${_HAVE_GOLD} != ""
|
||||
HAVE_GOLD?= ${_HAVE_GOLD}
|
||||
# CFLAGS+= -DHAVE_GOLD=${_HAVE_GOLD}
|
||||
# AFLAGS+= -DHAVE_GOLD=${_HAVE_GOLD}
|
||||
. else
|
||||
USE_BITCODE:=no
|
||||
. endif
|
||||
.endif # ${_HAVE_GOLD:U} == ""
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
#
|
||||
|
||||
+24
-37
@@ -474,27 +474,20 @@ _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
|
||||
.endfor
|
||||
|
||||
# Language-independent definitions.
|
||||
.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
|
||||
.if defined(__MINIX)
|
||||
.if ${USE_BITCODE:Uno} == "yes"
|
||||
CFLAGS+= -flto
|
||||
.endif # ${USE_BITCODE:Uno} == "yes"
|
||||
|
||||
. if ${LD_STATIC:U} != "-static"
|
||||
GOLDLINKERSCRIPT?= ${LDS_DYNAMIC_BIN}
|
||||
. else
|
||||
GOLDLINKERSCRIPT?= ${LDS_STATIC_BIN}
|
||||
. endif
|
||||
|
||||
.endif
|
||||
.if ${USE_BITCODE:Uyes} == "no"
|
||||
#LSC Gold linker seems to require the library directory to be set up if
|
||||
# a sysroot parameter has been given.
|
||||
LDFLAGS+= -L ${DESTDIR}/usr/lib
|
||||
.endif # ${USE_BITCODE:U} == "no"
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
.for _P in ${PROGS} ${PROGS_CXX} # {
|
||||
|
||||
.if defined(__MINIX) && ${HAVE_GOLD:U} != ""
|
||||
GOLDLINKERSCRIPT.${_P}?= ${GOLDLINKERSCRIPT}
|
||||
|
||||
. if ${GOLDLINKERSCRIPT.${_P}:U} != ""
|
||||
LDFLAGS.${_P}:=-Wl,--script,${GOLDLINKERSCRIPT.${_P}} ${LDFLAGS.${_P}}
|
||||
. endif
|
||||
.endif # defined(__MINIX) && ${HAVE_GOLD:U} == ""
|
||||
|
||||
BINDIR.${_P}?= ${BINDIR}
|
||||
PROGNAME.${_P}?= ${_P}
|
||||
|
||||
@@ -586,44 +579,38 @@ ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
|
||||
.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
|
||||
CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o
|
||||
|
||||
# We may (or not) be using a pass.
|
||||
. if ${LLVM_PASS:UNO_PASS} != "NO_PASS"
|
||||
_LLVM_PASS_ARGS= -load ${LLVM_PASS} ${LLVM_PASS_ARGS}
|
||||
_TARGET_BCL= ${_P}.opt.bcl
|
||||
. else
|
||||
_TARGET_BCL= ${_P}.bcl
|
||||
. endif # ${LLVM_PASS:UNO_PASS} != "NO_PASS"
|
||||
|
||||
|
||||
${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
|
||||
${LIBCRTEND} ${_DPADD.${_P}}
|
||||
${_MKTARGET_LINK}
|
||||
${_CCLINK.${_P}} \
|
||||
-o ${.TARGET} \
|
||||
-nostartfiles \
|
||||
-L/usr/lib/bc \
|
||||
-L${DESTDIR}/usr/lib/bc \
|
||||
${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \
|
||||
${_LDSTATIC.${_P}} \
|
||||
${_LDSTATIC.${_P}} ${_PROGLDOPTS} \
|
||||
-Wl,-r \
|
||||
-Wl,-plugin=/usr/pkg/lib/bfd-plugins/LLVMgold.so,-plugin-opt=-disable-opt,-plugin-opt=-disable-inlining,-plugin-opt=emit-llvm
|
||||
${BITCODE_LD_FLAGS} \
|
||||
-Wl,-plugin-opt=emit-llvm
|
||||
|
||||
${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS}
|
||||
${_MKTARGET_LINK}
|
||||
opt -disable-opt ${_LLVM_PASS_ARGS} -o ${.TARGET} ${_P}.bcl
|
||||
${OPT} ${OPTFLAGS} -o ${.TARGET} ${_P}.bcl
|
||||
|
||||
${_P}.bcl.o: ${_TARGET_BCL}
|
||||
${_P}.bcl.o: ${_P}.opt.bcl
|
||||
${_MKTARGET_LINK}
|
||||
llc -O1 -filetype=obj -o ${.TARGET} ${.ALLSRC}
|
||||
${LLC} -O1 -march=x86 -mcpu=i586 -filetype=obj -o ${.TARGET} ${.ALLSRC}
|
||||
|
||||
${_P}: ${_P}.bcl.o
|
||||
.if !commands(${_P})
|
||||
${_MKTARGET_LINK}
|
||||
${_CCLINK.${_P}} \
|
||||
-o ${.TARGET} \
|
||||
-L/usr/lib/bc \
|
||||
${.TARGET}.bcl.o ${_LDADD.${_P}} \
|
||||
${_LDSTATIC.${_P}} \
|
||||
-Wl,--script,${GOLDLINKERSCRIPT.${_P}} \
|
||||
-Wl,-plugin=/usr/pkg/lib/bfd-plugins/LLVMgold.so,-plugin-opt=-disable-opt,-plugin-opt=-disable-inlining
|
||||
${_LDFLAGS.${_P}} \
|
||||
-L${DESTDIR}/usr/lib \
|
||||
${_LDSTATIC.${_P}} -o ${.TARGET} \
|
||||
${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \
|
||||
${BITCODE_LD_FLAGS} \
|
||||
-Wl,--allow-multiple-definition
|
||||
.endif # !commands(${_P})
|
||||
|
||||
.else
|
||||
${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
|
||||
|
||||
+5
-2
@@ -36,7 +36,7 @@ CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
|
||||
# we wanted, and now we don't get anymore.
|
||||
CFLAGS+= -Wno-sign-compare
|
||||
CFLAGS+= ${${ACTIVE_CC} != "clang":? -Wno-traditional :}
|
||||
.if !defined(NOGCCERROR)
|
||||
.if !defined(NOGCCERROR) && !defined(USE_BITCODE)
|
||||
# Set assembler warnings to be fatal
|
||||
CFLAGS+= -Wa,--fatal-warnings
|
||||
.endif
|
||||
@@ -46,7 +46,7 @@ CFLAGS+= -Wa,--fatal-warnings
|
||||
.if (!defined(MKPIC) || ${MKPIC} != "no") && \
|
||||
(!defined(LDSTATIC) || ${LDSTATIC} != "-static")
|
||||
# XXX there are some strange problems not yet resolved
|
||||
. if !defined(HAVE_GCC) || defined(HAVE_LLVM)
|
||||
. if !defined(HAVE_GCC) || (defined(HAVE_LLVM) && !defined(USE_BITCODE))
|
||||
LDFLAGS+= -Wl,--fatal-warnings
|
||||
. endif
|
||||
.endif
|
||||
@@ -98,6 +98,9 @@ CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}}
|
||||
|
||||
CPPFLAGS+= ${AUDIT:D-D__AUDIT__}
|
||||
_NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no}
|
||||
.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
|
||||
_NOWERROR= yes
|
||||
.endif # defined(__MINIX) && ${USE_BITCODE} == "yes"
|
||||
CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS}
|
||||
LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include}
|
||||
|
||||
|
||||
@@ -14,17 +14,15 @@ COPTS+= -fno-builtin
|
||||
# 1. No default libs
|
||||
LDADD:= -nodefaultlibs ${LDADD}
|
||||
|
||||
# 2. Compiler-specific libs
|
||||
.if !empty(CC:M*gcc)
|
||||
# 2. Services system library
|
||||
LDADD+= -lsys
|
||||
DPADD+= ${LIBSYS}
|
||||
.elif !empty(CC:M*clang)
|
||||
LDADD+= -L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic
|
||||
.endif
|
||||
|
||||
# 3. Minimal C library
|
||||
# 3. Minimal C library, if libc had not yet been added
|
||||
.if ${LDADD:M-lc} == ""
|
||||
LDADD+= -lminc
|
||||
DPADD+= ${LIBMINC}
|
||||
.endif # empty(${LDADD:M-lc})
|
||||
|
||||
.if ${MACHINE_ARCH} == "earm"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user