mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
GCC External: Revert r300886, r300904, r300917, r300918
The fix in r300873 is mostly enough. A fix for lib32 will be committed.separately.
This commit is contained in:
parent
3f78f0a950
commit
f661dbee81
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300943
|
@ -527,7 +527,13 @@ TARGET_ABI= gnueabihf
|
||||||
TARGET_ABI= gnueabi
|
TARGET_ABI= gnueabi
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "clang"
|
.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
|
||||||
|
# GCC requires -isystem and -L when using a cross-compiler.
|
||||||
|
XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
|
||||||
|
# Force using libc++ for external GCC.
|
||||||
|
XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \
|
||||||
|
-nostdinc++ -L${WORLDTMP}/../lib/libc++
|
||||||
|
.else
|
||||||
TARGET_ABI?= unknown
|
TARGET_ABI?= unknown
|
||||||
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
|
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
|
||||||
XCFLAGS+= -target ${TARGET_TRIPLE}
|
XCFLAGS+= -target ${TARGET_TRIPLE}
|
||||||
|
|
|
@ -17,7 +17,7 @@ LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
||||||
.endif
|
.endif
|
||||||
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
|
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
|
||||||
MACHINE_CPU="i686 mmx sse sse2"
|
MACHINE_CPU="i686 mmx sse sse2"
|
||||||
LIB32WMAKEENV+= \
|
LIB32WMAKEFLAGS= \
|
||||||
AS="${XAS} --32" \
|
AS="${XAS} --32" \
|
||||||
LD="${XLD} -m elf_i386_fbsd -Y P,${LIBCOMPATTMP}/usr/lib32" \
|
LD="${XLD} -m elf_i386_fbsd -Y P,${LIBCOMPATTMP}/usr/lib32" \
|
||||||
OBJCOPY="${XOBJCOPY}"
|
OBJCOPY="${XOBJCOPY}"
|
||||||
|
@ -29,7 +29,7 @@ LIB32CPUFLAGS= -mcpu=powerpc
|
||||||
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
|
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
|
||||||
.endif
|
.endif
|
||||||
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
|
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
|
||||||
LIB32WMAKEENV+= \
|
LIB32WMAKEFLAGS= \
|
||||||
LD="${XLD} -m elf32ppc_fbsd" \
|
LD="${XLD} -m elf32ppc_fbsd" \
|
||||||
OBJCOPY="${XOBJCOPY}"
|
OBJCOPY="${XOBJCOPY}"
|
||||||
.endif
|
.endif
|
||||||
|
@ -72,6 +72,13 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \
|
||||||
# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for
|
# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for
|
||||||
# Clang/GCC.
|
# Clang/GCC.
|
||||||
LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat}
|
LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat}
|
||||||
|
.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
|
||||||
|
# GCC requires -isystem when using a cross-compiler.
|
||||||
|
LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include
|
||||||
|
# Force using libc++ for external GCC.
|
||||||
|
LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \
|
||||||
|
-nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++
|
||||||
|
.endif
|
||||||
|
|
||||||
# Yes, the flags are redundant.
|
# Yes, the flags are redundant.
|
||||||
LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \
|
LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \
|
||||||
|
@ -84,11 +91,9 @@ LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \
|
||||||
# Don't rebuild build-tools targets during normal build.
|
# Don't rebuild build-tools targets during normal build.
|
||||||
LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA_CMP
|
LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA_CMP
|
||||||
.endif
|
.endif
|
||||||
LIBCOMPATWMAKEENV+= \
|
LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
|
||||||
CC="${XCC} ${LIBCOMPATCFLAGS}" \
|
|
||||||
CXX="${XCXX} ${LIBCOMPATCFLAGS} ${LIBCOMPATCXXFLAGS}" \
|
CXX="${XCXX} ${LIBCOMPATCFLAGS} ${LIBCOMPATCXXFLAGS}" \
|
||||||
CPP="${XCPP} ${LIBCOMPATCFLAGS}"
|
CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
|
||||||
LIBCOMPATWMAKEFLAGS+= \
|
|
||||||
DESTDIR=${LIBCOMPATTMP} \
|
DESTDIR=${LIBCOMPATTMP} \
|
||||||
-DNO_CPU_CFLAGS \
|
-DNO_CPU_CFLAGS \
|
||||||
MK_CTF=no \
|
MK_CTF=no \
|
||||||
|
|
|
@ -63,7 +63,7 @@ cxxrt_${_S}: ${_LIBCXXRTDIR}/${_S} .NOMETA
|
||||||
.endfor
|
.endfor
|
||||||
|
|
||||||
WARNS= 0
|
WARNS= 0
|
||||||
CFLAGS+= -I${HDRDIR} -I${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT
|
CFLAGS+= -isystem ${HDRDIR} -isystem ${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT
|
||||||
.if empty(CXXFLAGS:M-std=*)
|
.if empty(CXXFLAGS:M-std=*)
|
||||||
CXXFLAGS+= -std=c++11
|
CXXFLAGS+= -std=c++11
|
||||||
.endif
|
.endif
|
||||||
|
|
|
@ -21,7 +21,7 @@ SRCS+= libelftc_dem_gnu3.c\
|
||||||
guard.cc
|
guard.cc
|
||||||
|
|
||||||
WARNS= 0
|
WARNS= 0
|
||||||
CFLAGS+= -I${SRCDIR} -nostdinc++
|
CFLAGS+= -isystem ${SRCDIR} -nostdinc++
|
||||||
.if empty(CXXFLAGS:M-std=*)
|
.if empty(CXXFLAGS:M-std=*)
|
||||||
CXXFLAGS+= -std=c++11
|
CXXFLAGS+= -std=c++11
|
||||||
.endif
|
.endif
|
||||||
|
|
|
@ -108,10 +108,8 @@ ccache-print-options: .PHONY
|
||||||
# CC and COMPILER_* settings here.
|
# CC and COMPILER_* settings here.
|
||||||
_exported_vars= ${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \
|
_exported_vars= ${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \
|
||||||
${X_}COMPILER_FREEBSD_VERSION
|
${X_}COMPILER_FREEBSD_VERSION
|
||||||
# Handle importing cached vars, but not for X_ vars.
|
${X_}_cc_hash= ${${cc}}${MACHINE}${PATH}
|
||||||
.if ${X_} == ""
|
${X_}_cc_hash:= ${${X_}_cc_hash:hash}
|
||||||
_cc_hash= ${${cc}}${MACHINE}${PATH}
|
|
||||||
_cc_hash:= ${_cc_hash:hash}
|
|
||||||
# Only import if none of the vars are set somehow else.
|
# Only import if none of the vars are set somehow else.
|
||||||
_can_export= yes
|
_can_export= yes
|
||||||
.for var in ${_exported_vars}
|
.for var in ${_exported_vars}
|
||||||
|
@ -121,12 +119,11 @@ _can_export= no
|
||||||
.endfor
|
.endfor
|
||||||
.if ${_can_export} == yes
|
.if ${_can_export} == yes
|
||||||
.for var in ${_exported_vars}
|
.for var in ${_exported_vars}
|
||||||
.if defined(${var}.${_cc_hash})
|
.if defined(${var}.${${X_}_cc_hash})
|
||||||
${var}= ${${var}.${_cc_hash}}
|
${var}= ${${var}.${${X_}_cc_hash}}
|
||||||
.endif
|
.endif
|
||||||
.endfor
|
.endfor
|
||||||
.endif
|
.endif
|
||||||
.endif # ${X_} == ""
|
|
||||||
|
|
||||||
.if ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
|
.if ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
|
||||||
.if ${MACHINE} == "common"
|
.if ${MACHINE} == "common"
|
||||||
|
@ -186,14 +183,9 @@ X_COMPILER_FEATURES= ${COMPILER_FEATURES}
|
||||||
# Export the values so sub-makes don't have to look them up again, using the
|
# Export the values so sub-makes don't have to look them up again, using the
|
||||||
# hash key computed above.
|
# hash key computed above.
|
||||||
.for var in ${_exported_vars}
|
.for var in ${_exported_vars}
|
||||||
.if ${X_} == ""
|
${var}.${${X_}_cc_hash}:= ${${var}}
|
||||||
${var}.${_cc_hash}:= ${${var}}
|
.export-env ${var}.${${X_}_cc_hash}
|
||||||
.export-env ${var}.${_cc_hash}
|
.undef ${var}.${${X_}_cc_hash}
|
||||||
.undef ${var}.${_cc_hash}
|
|
||||||
.else
|
|
||||||
# Always export X_ vars.
|
|
||||||
.export-env ${var}
|
|
||||||
.endif
|
|
||||||
.endfor
|
.endfor
|
||||||
|
|
||||||
.endif # ${cc} == "CC" || !empty(XCC)
|
.endif # ${cc} == "CC" || !empty(XCC)
|
||||||
|
|
|
@ -178,36 +178,6 @@ ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}}
|
||||||
CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
|
CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
|
||||||
CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
|
CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
|
||||||
|
|
||||||
# Special handling for external GCC.
|
|
||||||
.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "gcc"
|
|
||||||
# GCC's --sysroot support for a cross-compiler without a default
|
|
||||||
# TARGET_SYSTEM_ROOT does not add sysroot/usr/include in or the C++
|
|
||||||
# include path of sysroot/usr/include/c++/v1. They need to be added in
|
|
||||||
# when not using -nostdinc/-nostdinc++. This is not a problem with a
|
|
||||||
# non-cross-compiler external GCC or the in-tree cross-compiler GCC which
|
|
||||||
# has a default TARGET_SYSTEM_ROOT.
|
|
||||||
.if ${CC:M--sysroot=*} || ${CFLAGS:M--sysroot=*}
|
|
||||||
.if ${CFLAGS:M-nostdinc} == ""
|
|
||||||
CFLAGS+= -isystem =/usr/include
|
|
||||||
.endif
|
|
||||||
# We want to force building the system with our in-tree libc++. Note that
|
|
||||||
# this also requires a symlink in OBJDIR/lib/libc++/libstdc++.so to
|
|
||||||
# sysroot/usr/lib/libc++.so.
|
|
||||||
.if ${CXXFLAGS:M-nostdinc++} == "" && ${CXXFLAGS:M-nostdlib} == ""
|
|
||||||
CXXFLAGS+= -std=c++11 \
|
|
||||||
-nostdinc++
|
|
||||||
# Need to ensure this path comes before the above -isystem =/usr/include.
|
|
||||||
# CXXFLAGS is CFLAGS with extra added in, so there's no way to fix the
|
|
||||||
# ordering otherwise.
|
|
||||||
CXX+= -isystem =/usr/include/c++/v1
|
|
||||||
LDFLAGS+= -L${OBJTOP}/lib/libc++
|
|
||||||
.endif
|
|
||||||
# Add in sysroot/usr/lib to ensure that it comes before /usr/local/lib
|
|
||||||
# from ports compilers.
|
|
||||||
LDFLAGS+= -L=/usr/lib
|
|
||||||
.endif # --sysroot
|
|
||||||
.endif # X_COMPILER_TYPE == gcc
|
|
||||||
|
|
||||||
.if defined(SRCTOP)
|
.if defined(SRCTOP)
|
||||||
# Prevent rebuilding during install to support read-only objdirs.
|
# Prevent rebuilding during install to support read-only objdirs.
|
||||||
.if !make(all) && make(install) && empty(.MAKE.MODE:Mmeta)
|
.if !make(all) && make(install) && empty(.MAKE.MODE:Mmeta)
|
||||||
|
|
Loading…
Reference in a new issue