Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108105224
D4787.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D4787.diff
View Options
Index: head/gnu/lib/libgcc/Makefile
===================================================================
--- head/gnu/lib/libgcc/Makefile
+++ head/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_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 @@
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 @@
.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 @@
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_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
#-----------------------------------------------------------------------
Index: head/share/mk/src.opts.mk
===================================================================
--- head/share/mk/src.opts.mk
+++ head/share/mk/src.opts.mk
@@ -231,9 +231,9 @@
# 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"
Index: head/tools/build/options/WITHOUT_LLVM_LIBUNWIND
===================================================================
--- head/tools/build/options/WITHOUT_LLVM_LIBUNWIND
+++ head/tools/build/options/WITHOUT_LLVM_LIBUNWIND
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to use GCC's stack unwinder (instead of LLVM's libunwind).
Index: head/tools/build/options/WITH_LLVM_LIBUNWIND
===================================================================
--- head/tools/build/options/WITH_LLVM_LIBUNWIND
+++ head/tools/build/options/WITH_LLVM_LIBUNWIND
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder).
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 10:54 AM (10 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16029108
Default Alt Text
D4787.diff (4 KB)
Attached To
Mode
D4787: Support use of LLVM's libunwind instead of GCC's unwinder
Attached
Detach File
Event Timeline
Log In to Comment