freebsd-skq/lib/clang/llvm.build.mk
emaste 48f45a5a5b Add -mlong-calls also to LLVM's STATIC_CFLAGS on ARM
-mlong-calls was set only in STATIC_CXXFLAGS, but there are some .c
source files in LLVM which also need -mlong-calls.

Unfortunately this is not sufficient to fix linking lldb on ARM,
because LLVM-generated calls to __aeabi_read_tp do not honour the
-mlong-calls flag.  See LLVM PR31769 for details.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9348
2017-01-27 21:26:23 +00:00

52 lines
1.4 KiB
Makefile

# $FreeBSD$
.ifndef LLVM_SRCS
.error Please define LLVM_SRCS before including this file
.endif
.ifndef SRCDIR
.error Please define SRCDIR before including this file
.endif
.PATH: ${LLVM_SRCS}/${SRCDIR}
CFLAGS+= -I${SRCTOP}/lib/clang/include
CFLAGS+= -I${LLVM_SRCS}/include
CFLAGS+= -DLLVM_ON_UNIX
CFLAGS+= -DLLVM_ON_FREEBSD
CFLAGS+= -D__STDC_LIMIT_MACROS
CFLAGS+= -D__STDC_CONSTANT_MACROS
#CFLAGS+= -DNDEBUG
TARGET_ARCH?= ${MACHINE_ARCH}
BUILD_ARCH?= ${MACHINE_ARCH}
# Armv6 uses hard float abi, unless the CPUTYPE has soft in it.
# arm (for armv4 and armv5 CPUs) always uses the soft float ABI.
# For all other targets, we stick with 'unknown'.
.if ${TARGET_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
TARGET_ABI= gnueabihf
.elif ${TARGET_ARCH:Marm*}
TARGET_ABI= gnueabi
.else
TARGET_ABI= unknown
.endif
OS_VERSION= freebsd12.0
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${TARGET_ABI}-${OS_VERSION}
BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-unknown-${OS_VERSION}
CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\"
CFLAGS+= -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\"
CFLAGS+= -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
CXXFLAGS+= -std=c++11
CXXFLAGS+= -fno-exceptions
CXXFLAGS+= -fno-rtti
CXXFLAGS.clang+= -stdlib=libc++
.if ${MACHINE_CPUARCH} == "arm"
STATIC_CFLAGS+= -mlong-calls
STATIC_CXXFLAGS+= -mlong-calls
.endif