diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index c731deba8976..e88b2ff1033e 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -1,132 +1,133 @@ .include .ifndef LLVM_BASE .error Please define LLVM_BASE before including this file .endif .ifndef LLVM_SRCS .error Please define LLVM_SRCS before including this file .endif .ifndef SRCDIR .error Please define SRCDIR before including this file .endif .ifndef OS_REVISION .error Please define OS_REVISION before including this file .endif .PATH: ${LLVM_BASE}/${SRCDIR} CFLAGS+= -I${SRCTOP}/lib/clang/include CFLAGS+= -I${LLVM_SRCS}/include CFLAGS+= -D__STDC_CONSTANT_MACROS CFLAGS+= -D__STDC_FORMAT_MACROS CFLAGS+= -D__STDC_LIMIT_MACROS CFLAGS+= -DHAVE_VCS_VERSION_INC .if ${MK_LLVM_ASSERTIONS} == "no" CFLAGS+= -DNDEBUG .endif # Note that using TARGET_ARCH here is essential for a functional native-xtools # build! For native-xtools, we're building binaries that will work on the # *host* machine (MACHINE_ARCH), but they should default to producing binaries # for the *target* machine (TARGET_ARCH). TARGET_ARCH?= ${MACHINE_ARCH} BUILD_ARCH?= ${MACHINE_ARCH} # Armv6 and armv7 uses hard float abi, unless the CPUTYPE has soft in it. # For all other targets, we stick with 'unknown'. .if ${TARGET_ARCH:Marm*} .if !defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "" TARGET_TRIPLE_ABI=-gnueabihf .else TARGET_TRIPLE_ABI=-gnueabi .endif .else TARGET_TRIPLE_ABI= .endif VENDOR= unknown LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${VENDOR}-freebsd${OS_REVISION}${TARGET_TRIPLE_ABI} LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-${VENDOR}-freebsd${OS_REVISION} CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${LLVM_TARGET_TRIPLE}\" CFLAGS+= -DLLVM_HOST_TRIPLE=\"${LLVM_BUILD_TRIPLE}\" CFLAGS+= -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" .if ${MK_LLVM_TARGET_AARCH64} != "no" CFLAGS+= -DLLVM_TARGET_ENABLE_AARCH64 . if ${MACHINE_CPUARCH} == "aarch64" LLVM_NATIVE_ARCH= AArch64 . endif .endif .if ${MK_LLVM_TARGET_ARM} != "no" CFLAGS+= -DLLVM_TARGET_ENABLE_ARM . if ${MACHINE_CPUARCH} == "arm" LLVM_NATIVE_ARCH= ARM . endif .endif .if ${MK_LLVM_TARGET_BPF} != "no" CFLAGS+= -DLLVM_TARGET_ENABLE_BPF .endif .if ${MK_LLVM_TARGET_MIPS} != "no" CFLAGS+= -DLLVM_TARGET_ENABLE_MIPS .endif .if ${MK_LLVM_TARGET_POWERPC} != "no" CFLAGS+= -DLLVM_TARGET_ENABLE_POWERPC . if ${MACHINE_CPUARCH} == "powerpc" LLVM_NATIVE_ARCH= PowerPC . endif .endif .if ${MK_LLVM_TARGET_RISCV} != "no" CFLAGS+= -DLLVM_TARGET_ENABLE_RISCV . if ${MACHINE_CPUARCH} == "riscv" LLVM_NATIVE_ARCH= RISCV . endif .endif .if ${MK_LLVM_TARGET_X86} != "no" CFLAGS+= -DLLVM_TARGET_ENABLE_X86 . if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" LLVM_NATIVE_ARCH= X86 . endif .endif .ifdef LLVM_NATIVE_ARCH CFLAGS+= -DLLVM_NATIVE_ASMPARSER=LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser CFLAGS+= -DLLVM_NATIVE_ASMPRINTER=LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter CFLAGS+= -DLLVM_NATIVE_DISASSEMBLER=LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler CFLAGS+= -DLLVM_NATIVE_TARGET=LLVMInitialize${LLVM_NATIVE_ARCH}Target CFLAGS+= -DLLVM_NATIVE_TARGETINFO=LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC .endif CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections .include "bsd.linker.mk" .if ${LINKER_TYPE} == "mac" LDFLAGS+= -Wl,-dead_strip .else LDFLAGS+= -Wl,--gc-sections # XXX: --gc-sections strips the ELF brand note and on RISC-V the OS/ABI ends up # as NONE, so for statically-linked binaries, i.e. lacking an interpreter, # get_brandinfo finds nothing and (f)execve fails with ENOEXEC. Work around # this by manually setting the OS/ABI field via the emulation. .if ${MACHINE_ARCH:Mriscv64*} != "" && ${NO_SHARED:Uno:tl} != "no" && \ (${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)) LDFLAGS+= -Wl,-m,elf64lriscv_fbsd .endif .endif +CXXSTD= c++17 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) CXXFLAGS.clang+= -stdlib=libc++ .else # Building on macOS/Linux needs the real sysctl() not the bootstrap tools stub. CFLAGS+= -DBOOTSTRAPPING_WANT_NATIVE_SYSCTL .endif .if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux" LIBADD+= dl .endif diff --git a/lib/libclang_rt/Makefile.inc b/lib/libclang_rt/Makefile.inc index e7db5a469661..c472e8b741be 100644 --- a/lib/libclang_rt/Makefile.inc +++ b/lib/libclang_rt/Makefile.inc @@ -1,35 +1,36 @@ .include PACKAGE= clang CRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt .include "compiler-rt-vars.mk" .PATH: ${CRTSRC}/lib LIBDIR= ${SANITIZER_LIBDIR} SHLIBDIR= ${LIBDIR} NO_PIC= MK_ASAN:= no MK_SSP= no MK_UBSAN:= no WARNS?= 0 CFLAGS+= -DNDEBUG CFLAGS+= -DHAVE_RPC_XDR_H=0 CFLAGS+= -DSANITIZER_SUPPORTS_WEAK_HOOKS=0 CFLAGS+= -DUBSAN_CAN_USE_CXXABI CFLAGS+= ${PICFLAG} CFLAGS+= -fno-builtin CFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti .if ${COMPILER_TYPE} == clang CFLAGS+= -fno-sanitize=safe-stack .endif CFLAGS+= -fno-stack-protector CFLAGS+= -funwind-tables CXXFLAGS+= -fvisibility-inlines-hidden CXXFLAGS+= -fvisibility=hidden CFLAGS+= -I${CRTSRC}/include CFLAGS+= -I${CRTSRC}/lib +CXXSTD= c++17 diff --git a/lib/libomp/Makefile b/lib/libomp/Makefile index f1513e70f3f6..6c14c7d21077 100644 --- a/lib/libomp/Makefile +++ b/lib/libomp/Makefile @@ -1,96 +1,97 @@ # z_Linux_asm.S is missing BTI support MK_BRANCH_PROTECTION=no .include SHLIB_NAME= libomp.so OMPSRC= ${SRCTOP}/contrib/llvm-project/openmp/runtime/src ITTSRC= ${OMPSRC}/thirdparty/ittnotify .PATH: ${OMPSRC} .PATH: ${ITTSRC} SRCS+= ittnotify_static.cpp SRCS+= kmp_affinity.cpp SRCS+= kmp_alloc.cpp SRCS+= kmp_atomic.cpp SRCS+= kmp_barrier.cpp SRCS+= kmp_cancel.cpp SRCS+= kmp_csupport.cpp SRCS+= kmp_debug.cpp SRCS+= kmp_dispatch.cpp SRCS+= kmp_environment.cpp SRCS+= kmp_error.cpp SRCS+= kmp_ftn_cdecl.cpp SRCS+= kmp_ftn_extra.cpp SRCS+= kmp_global.cpp SRCS+= kmp_gsupport.cpp SRCS+= kmp_i18n.cpp SRCS+= kmp_io.cpp SRCS+= kmp_itt.cpp SRCS+= kmp_lock.cpp SRCS+= kmp_runtime.cpp SRCS+= kmp_sched.cpp SRCS+= kmp_settings.cpp SRCS+= kmp_str.cpp SRCS+= kmp_taskdeps.cpp SRCS+= kmp_tasking.cpp SRCS+= kmp_threadprivate.cpp SRCS+= kmp_utility.cpp SRCS+= kmp_version.cpp SRCS+= kmp_wait_release.cpp SRCS+= ompt-general.cpp SRCS+= z_Linux_asm.S SRCS+= z_Linux_util.cpp INCS+= omp.h WARNS?= 1 CFLAGS+= -D__STDC_CONSTANT_MACROS CFLAGS+= -D__STDC_FORMAT_MACROS CFLAGS+= -D__STDC_LIMIT_MACROS CFLAGS+= -I${.CURDIR} CFLAGS+= -I${OMPSRC} CFLAGS+= -I${ITTSRC} CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections CXXFLAGS+= -fvisibility-inlines-hidden CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti +CXXSTD= c++17 .if ${COMPILER_TYPE} == "clang" .if ${MACHINE_CPUARCH} == "i386" .if ${COMPILER_VERSION} >= 90000 # When targeting i386, clang 9.0.0 produces a new warning about large atomic # operations "possibly incurring significant performance penalties", but there # is not much we can do about it. CWARNFLAGS+= -Wno-atomic-alignment .endif .if ${COMPILER_VERSION} >= 170000 # When targeting i386, clang 17.0.0 produces a new warning that __sync # builtin operations must have natural alignment, but there is not much we # can do about it. CWARNFLAGS+= -Wno-sync-alignment .endif # COMPILER_VERSION >= 170000 .endif # MACHINE_CPUARCH == i386 .if ${COMPILER_VERSION} >= 180000 # clang 18.0.0 introduces a new warning about variable length arrays in C++, # which OpenMP makes use of in several sources. CXXWARNFLAGS+= -Wno-vla-cxx-extension .endif # COMPILER_VERSION >= 180000 .endif # COMPILER_TYPE == clang LDFLAGS+= -Wl,--warn-shared-textrel LDFLAGS+= -Wl,--gc-sections LDFLAGS+= -Wl,-z,noexecstack LDFLAGS+= -Wl,-fini=__kmp_internal_end_fini LDFLAGS+= -Wl,-soname,libomp.so VERSION_MAP= ${OMPSRC}/exports_so.txt LIBADD+= pthread LIBADD+= m SYMLINKS+= ${SHLIB_NAME} ${LIBDIR}/libgomp.so .include