diff options
-rw-r--r-- | gnu/lib/libgcc/Makefile | 55 | ||||
-rw-r--r-- | share/mk/src.opts.mk | 4 | ||||
-rw-r--r-- | tools/build/options/WITHOUT_LLVM_LIBUNWIND | 2 | ||||
-rw-r--r-- | tools/build/options/WITH_LLVM_LIBUNWIND | 2 |
4 files changed, 57 insertions, 6 deletions
diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile index 6972146..ad4e0f1 100644 --- a/gnu/lib/libgcc/Makefile +++ b/gnu/lib/libgcc/Makefile @@ -2,6 +2,9 @@ GCCDIR= ${.CURDIR}/../../../contrib/gcc GCCLIB= ${.CURDIR}/../../../contrib/gcclibs +COMPILERRTDIR= ${.CURDIR}/../../../contrib/compiler-rt +UNWINDINCDIR= ${.CURDIR}/../../../contrib/llvm/projects/libunwind/include +UNWINDSRCDIR= ${.CURDIR}/../../../contrib/llvm/projects/libunwind/src SHLIB_NAME= libgcc_s.so.1 SHLIBDIR?= /lib @@ -67,8 +70,37 @@ LIB2ADD = $(LIB2FUNCS_EXTRA) LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA) # Additional sources to handle exceptions; overridden by targets as needed. +.if ${MK_LLVM_LIBUNWIND} != "no" + +.PATH: ${COMPILERRTDIR}/lib/builtins +.PATH: ${UNWINDSRCDIR} +LIB2ADDEH = gcc_personality_v0.c \ + int_util.c \ + Unwind-EHABI.cpp \ + Unwind-sjlj.c \ + UnwindLevel1-gcc-ext.c \ + UnwindLevel1.c \ + UnwindRegistersRestore.S \ + UnwindRegistersSave.S \ + libunwind.cpp + +CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif +CXXFLAGS+= -fno-rtti + +.else # MK_LLVM_LIBUNWIND + +.if ${TARGET_CPUARCH} == "arm" +LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c +.else LIB2ADDEH = unwind-dw2.c unwind-dw2-fde-glibc.c unwind-sjlj.c gthr-gnat.c \ unwind-c.c +.endif + +.endif # MK_LLVM_LIBUNWIND + LIB2ADDEHSTATIC = $(LIB2ADDEH) LIB2ADDEHSHARED = $(LIB2ADDEH) @@ -116,7 +148,6 @@ CFLAGS.clang+= -fheinous-gnu-extensions LIB1ASMSRC = lib1funcs.asm LIB1ASMFUNCS = _dvmd_tls _bb_init_func -LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c # Some compilers generate __aeabi_ functions libgcc_s is missing LIBADD+= compiler_rt .endif @@ -160,7 +191,10 @@ LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g} .endfor .endif -COMMONHDRS= tm.h tconfig.h options.h unwind.h gthr-default.h +COMMONHDRS= tm.h tconfig.h options.h gthr-default.h +.if ${MK_LLVM_LIBUNWIND} == no +COMMONHDRS+= unwind.h +.endif #----------------------------------------------------------------------- # @@ -170,6 +204,9 @@ HIDE = -fvisibility=hidden -DHIDE_EXPORTS CC_T = ${CC} -c ${CFLAGS} ${HIDE} -fPIC CC_P = ${CC} -c ${CFLAGS} ${HIDE} -p -fPIC CC_S = ${CC} -c ${CFLAGS} ${PICFLAG} -DSHARED +CXX_T = ${CXX} -c ${CXXFLAGS} ${HIDE} -fPIC +CXX_P = ${CXX} -c ${CXXFLAGS} ${HIDE} -p -fPIC +CXX_S = ${CXX} -c ${CXXFLAGS} ${PICFLAG} -DSHARED #----------------------------------------------------------------------- # @@ -284,16 +321,26 @@ EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/} EH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN SOBJS += ${EH_OBJS_S} -.for _src in ${LIB2ADDEHSTATIC} +.for _src in ${LIB2ADDEHSTATIC:M*.c} ${_src:R:S/$/.o/}: ${_src} ${COMMONHDRS} ${CC_T} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} ${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS} ${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor -.for _src in ${LIB2ADDEHSHARED} +.for _src in ${LIB2ADDEHSTATIC:M*.cpp} +${_src:R:S/$/.o/}: ${_src} ${COMMONHDRS} + ${CXX_T} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} +${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS} + ${CXX_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} +.endfor +.for _src in ${LIB2ADDEHSHARED:M*.c} ${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} ${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor +.for _src in ${LIB2ADDEHSHARED:M*.cpp} +${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} + ${CXX_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} +.endfor #----------------------------------------------------------------------- diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 47a67e0..678c31e 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -231,9 +231,9 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC # In-tree binutils/gcc are older versions without modern architecture support. .if ${__T} == "aarch64" || ${__T} == "riscv64" BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB -__DEFAULT_YES_OPTIONS+=ELFCOPY_AS_OBJCOPY +__DEFAULT_YES_OPTIONS+=ELFCOPY_AS_OBJCOPY LLVM_LIBUNWIND .else -__DEFAULT_NO_OPTIONS+=ELFCOPY_AS_OBJCOPY +__DEFAULT_NO_OPTIONS+=ELFCOPY_AS_OBJCOPY LLVM_LIBUNWIND .endif .if ${__T} == "riscv64" BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V" diff --git a/tools/build/options/WITHOUT_LLVM_LIBUNWIND b/tools/build/options/WITHOUT_LLVM_LIBUNWIND new file mode 100644 index 0000000..63a9042 --- /dev/null +++ b/tools/build/options/WITHOUT_LLVM_LIBUNWIND @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to use GCC's stack unwinder (instead of LLVM's libunwind). diff --git a/tools/build/options/WITH_LLVM_LIBUNWIND b/tools/build/options/WITH_LLVM_LIBUNWIND new file mode 100644 index 0000000..ff63884 --- /dev/null +++ b/tools/build/options/WITH_LLVM_LIBUNWIND @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). |