svn commit: r360643 - in stable/11: . gnu/lib gnu/lib/libgcc lib lib/libgcc_eh lib/libgcc_s
Dimitry Andric
dim at FreeBSD.org
Mon May 4 22:59:41 UTC 2020
Author: dim
Date: Mon May 4 22:59:39 2020
New Revision: 360643
URL: https://svnweb.freebsd.org/changeset/base/360643
Log:
Merge additions of LLVM libunwind libgcc_eh and libgcc_s. This is in
preparation of further LLVM merges.
MFC r307230 (by emaste):
Introduce lib/libgcc_eh and lib/libgcc_s for LLVM's implementation
They are not yet connected to the build, but I am adding them to allow
for easier testing, ports exp-runs, etc.
Reviewed by: ed
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8188
MFC r307231 (by emaste):
libgcc_s: add libm dependencies from div{d,s,x}c3
compiler-rt's complex division support routines contain calls to
compiler builtins such as `__builtin_scalbnl`. Unfortunately Clang
turns these back into a call to `scalbnl`.
For now link libm's C version of the required support routines.
Reviewed by: ed
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8190
MFC r307864 (by emaste):
Move the LLVM-based libgcc_s to /lib
When enabled, it should install in the same location as the existing
library.
Reported by: antoine
MFC r308001 (by emaste):
libgcc_eh/libgcc_s: apply hidden visibility only to static libs
MFC r308100 (by emaste):
compile libunwind c source with -fexceptions
When an exception is thrown the unwinder must unwind its own C source
(starting with _Unwind_RaiseException in UnwindLevel1.c), so it needs to
be built with unwinding data.
MFC r308294 (by emaste):
libgcc_s: make unspecified shlib symbols local
We want only symbols explicitly specified in the Version.map.
Sponsored by: The FreeBSD Foundation
MFC r308308 (by emaste):
Connect new LLVM-based libgcc_eh & libgcc_s to the build
Compiler-rt and LLVM's libunwind provide a suitable replacement for
libgcc.a, libgcc_eh.a, and libgcc_s.so.
Remove the now-unused LLVM_LIBUNWIND block from gnu/lib/libgcc.
PR: 213480 [exp-run]
Reviewed by: brooks, ed
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8189
MFC r308379 (by emaste):
add __divdi3 and __udivdi3 to libgcc_s symbol version map
After r308294 they were missing on i386 (and previously were exported
only accidentally).
Reported by: antoine
MFC r308445 (by emaste):
add missing i386 symbols libgcc_s symbol version map
After r308294 they were missing on i386 (and previously were exported
only accidentally).
Reported by: antoine
MFC r312076 (by emaste):
libgcc_s: add libc DT_NEEDED to fix underlinking
PR: 216012
Reported by: jbeich
Sponsored by: The FreeBSD Foundation
MFC r316101 (by ngie):
Apply r315689 to lib/libgcc_s as well to unbreak the gcc xtoolchain build
lib/libgcc_s consumes lib/libcompiler_rt/Makefile*. The NO_WERROR.gcc in
lib/libcompiler_rt/Makefile doesn't seem to have made a difference in being
able to build this, so sprinkle NO_WERROR.gcc here as well.
Reported by: Jenkins (FreeBSD-head-amd64-gcc)
Tested with: amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
Sponsored by: Dell EMC Isilon
MFC r320673 (by emaste):
Sort entries in libgcc_s Version.map
MFC r337585 (by dim):
In r308100, an explicit -fexceptions flag was added for the C sources
from LLVM's libunwind, which end up in libgcc_eh.a and libgcc_s.so.
This is because the unwinder needs the unwinder data for its own
functions.
However, for the C++ sources in libunwind, -fexceptions is already the
default, and this can have the side effect of generating a reference to
__gxx_personality_v0, the so-called personality function, which is
normally provided by the C++ ABI library (libcxxrt or libsupc++).
If the reference ends up in the eventual libgcc_s.so, linking any
non-C++ programs against it will fail with "undefined reference to
`__gxx_personality_v0'".
Note that at high optimization levels, the reference is usually
optimized away, which is why we have never noticed this problem before.
With clang 7.0.0 though, higher optimization levels don't help anymore,
since the addition of address-significance tables [1] in
<https://reviews.llvm.org/rL337339>. Effectively, this always causes a
reference to __gxx_personality_v0.
After discussion with the upstream author of that change, it turns out
that we should compile libunwind sources with the -fno-exceptions
-funwind-tables flags instead. This ensures unwind tables are
generated, but no references to any personality functions are emitted.
[1] https://lists.llvm.org/pipermail/llvm-dev/2018-May/123514.html
Reported by: jbeich
PR: 230399
Added:
stable/11/lib/libgcc_eh/
- copied from r307230, head/lib/libgcc_eh/
stable/11/lib/libgcc_s/
- copied from r307230, head/lib/libgcc_s/
Modified:
stable/11/Makefile.inc1
stable/11/gnu/lib/Makefile
stable/11/gnu/lib/libgcc/Makefile
stable/11/lib/Makefile
stable/11/lib/libgcc_eh/Makefile.inc
stable/11/lib/libgcc_s/Makefile
stable/11/lib/libgcc_s/Version.map
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/Makefile.inc1
==============================================================================
--- stable/11/Makefile.inc1 Mon May 4 22:31:38 2020 (r360642)
+++ stable/11/Makefile.inc1 Mon May 4 22:59:39 2020 (r360643)
@@ -2117,7 +2117,7 @@ libraries: .MAKE .PHONY
#
# static libgcc.a prerequisite for shared libc
#
-_prereq_libs= lib/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
+_prereq_libs= lib/libssp_nonshared lib/libcompiler_rt
# These dependencies are not automatically generated:
#
@@ -2126,7 +2126,6 @@ _prereq_libs= lib/libssp_nonshared gnu/lib/libgcc lib/
#
_startup_libs= gnu/lib/csu
_startup_libs+= lib/csu
-_startup_libs+= gnu/lib/libgcc
_startup_libs+= lib/libcompiler_rt
_startup_libs+= lib/libc
_startup_libs+= lib/libc_nonshared
@@ -2134,10 +2133,26 @@ _startup_libs+= lib/libc_nonshared
_startup_libs+= lib/libcxxrt
.endif
+.if ${MK_LLVM_LIBUNWIND} != "no"
+_prereq_libs+= lib/libgcc_eh lib/libgcc_s
+_startup_libs+= lib/libgcc_eh lib/libgcc_s
+
+lib/libgcc_s__L: lib/libc__L
+lib/libgcc_s__L: lib/libc_nonshared__L
+.if ${MK_LIBCPLUSPLUS} != "no"
+lib/libcxxrt__L: lib/libgcc_s__L
+.endif
+
+.else # MK_LLVM_LIBUNWIND == no
+
+_prereq_libs+= gnu/lib/libgcc
+_startup_libs+= gnu/lib/libgcc
+
gnu/lib/libgcc__L: lib/libc__L
gnu/lib/libgcc__L: lib/libc_nonshared__L
.if ${MK_LIBCPLUSPLUS} != "no"
lib/libcxxrt__L: gnu/lib/libgcc__L
+.endif
.endif
_prebuild_libs= ${_kerberos5_lib_libasn1} \
Modified: stable/11/gnu/lib/Makefile
==============================================================================
--- stable/11/gnu/lib/Makefile Mon May 4 22:31:38 2020 (r360642)
+++ stable/11/gnu/lib/Makefile Mon May 4 22:59:39 2020 (r360643)
@@ -4,7 +4,6 @@
SUBDIR= csu
SUBDIR+= libdialog
-SUBDIR+= libgcc
.if ${MK_GCC} != "no" && ${MK_OPENMP} == "no"
SUBDIR+= libgcov libgomp
@@ -21,6 +20,10 @@ SUBDIR+= libreadline
.if ${MK_GNU_DIFF} != "no" || ${MK_GNU_GREP} != "no" || \
${MK_GNU_GREP_COMPAT} != "no" || ${MK_GDB} != "no"
SUBDIR+= libregex
+.endif
+
+.if ${MK_LLVM_LIBUNWIND} == "no"
+SUBDIR+= libgcc
.endif
# libsupc++ uses libstdc++ headers, although 'make includes' should
Modified: stable/11/gnu/lib/libgcc/Makefile
==============================================================================
--- stable/11/gnu/lib/libgcc/Makefile Mon May 4 22:31:38 2020 (r360642)
+++ stable/11/gnu/lib/libgcc/Makefile Mon May 4 22:59:39 2020 (r360643)
@@ -4,9 +4,6 @@ PACKAGE= clibs
GCCDIR= ${.CURDIR}/../../../contrib/gcc
GCCLIB= ${.CURDIR}/../../../contrib/gcclibs
CCDIR= ${.CURDIR}/../../usr.bin/cc
-COMPILERRTDIR= ${.CURDIR}/../../../contrib/compiler-rt
-UNWINDINCDIR= ${.CURDIR}/../../../contrib/libunwind/include
-UNWINDSRCDIR= ${.CURDIR}/../../../contrib/libunwind/src
SHLIB_NAME= libgcc_s.so.1
SHLIBDIR?= /lib
@@ -74,41 +71,7 @@ LIB2FUNCS+= _floatdi${mode} _floatundi${mode}
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
-
-.for file in ${LIB2ADDEH:M*.c}
-CFLAGS.${file}+= -fno-exceptions -funwind-tables
-.endfor
-.for file in ${LIB2ADDEH:M*.cpp}
-CXXFLAGS.${file}+= -fno-exceptions -funwind-tables
-.endfor
-
-CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY
-.if empty(CXXFLAGS:M-std=*)
-CXXFLAGS+= -std=c++11
-.endif
-CXXFLAGS+= -fno-rtti
-STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC
-.if ${MK_DIRDEPS_BUILD} == "yes"
-# Avoid dependency on lib/libc++
-CFLAGS+= -I${SRCTOP}/contrib/libc++/include
-.endif
-
-.else # MK_LLVM_LIBUNWIND
-
.if ${TARGET_CPUARCH} == "arm"
LIB2ADDEH = unwind-arm.c libunwind-arm.S pr-support.c unwind-c.c
.else
@@ -116,8 +79,6 @@ LIB2ADDEH = unwind-dw2.c unwind-dw2-fde-glibc.c unwind
unwind-c.c
.endif
-.endif # MK_LLVM_LIBUNWIND
-
LIB2ADDEHSTATIC = $(LIB2ADDEH)
LIB2ADDEHSHARED = $(LIB2ADDEH)
@@ -209,14 +170,7 @@ LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
.endif
COMMONHDRS= tm.h tconfig.h options.h gthr-default.h
-.if ${MK_LLVM_LIBUNWIND} != "no"
-# unwind.h is a generated file when MK_LLVM_LIBUNWIND == "no", and a stale
-# copy may be left behind in OBJDIR when switching, so remove it explicitly.
-beforebuild:
- @rm -f ${.OBJDIR}/unwind.h
-.else
COMMONHDRS+= unwind.h
-.endif
#-----------------------------------------------------------------------
#
Modified: stable/11/lib/Makefile
==============================================================================
--- stable/11/lib/Makefile Mon May 4 22:31:38 2020 (r360642)
+++ stable/11/lib/Makefile Mon May 4 22:59:39 2020 (r360643)
@@ -250,6 +250,9 @@ _libefivar= libefivar
_libthr= libthr
.endif
+SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh
+SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s
+
.if ${MK_NAND} != "no"
_libnandfs= libnandfs
.endif
Modified: stable/11/lib/libgcc_eh/Makefile.inc
==============================================================================
--- head/lib/libgcc_eh/Makefile.inc Thu Oct 13 18:57:18 2016 (r307230)
+++ stable/11/lib/libgcc_eh/Makefile.inc Mon May 4 22:59:39 2020 (r360643)
@@ -1,22 +1,30 @@
# $FreeBSD$
COMPILERRTDIR= ${SRCTOP}/contrib/compiler-rt
-UNWINDINCDIR= ${SRCTOP}/contrib/llvm/projects/libunwind/include
-UNWINDSRCDIR= ${SRCTOP}/contrib/llvm/projects/libunwind/src
+UNWINDINCDIR= ${SRCTOP}/contrib/libunwind/include
+UNWINDSRCDIR= ${SRCTOP}/contrib/libunwind/src
-CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
+STATIC_CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
.PATH: ${COMPILERRTDIR}/lib/builtins
.PATH: ${UNWINDSRCDIR}
-SRCS+= gcc_personality_v0.c
-SRCS+= int_util.c
-SRCS+= Unwind-EHABI.cpp
-SRCS+= Unwind-sjlj.c
-SRCS+= UnwindLevel1-gcc-ext.c
-SRCS+= UnwindLevel1.c
-SRCS+= UnwindRegistersRestore.S
-SRCS+= UnwindRegistersSave.S
-SRCS+= libunwind.cpp
+SRCS_EXC+= gcc_personality_v0.c
+SRCS_EXC+= int_util.c
+SRCS_EXC+= Unwind-EHABI.cpp
+SRCS_EXC+= Unwind-sjlj.c
+SRCS_EXC+= UnwindLevel1-gcc-ext.c
+SRCS_EXC+= UnwindLevel1.c
+SRCS_EXC+= UnwindRegistersRestore.S
+SRCS_EXC+= UnwindRegistersSave.S
+SRCS_EXC+= libunwind.cpp
+
+SRCS+= ${SRCS_EXC}
+.for file in ${SRCS_EXC:M*.c}
+CFLAGS.${file}+= -fno-exceptions -funwind-tables
+.endfor
+.for file in ${SRCS_EXC:M*.cpp}
+CXXFLAGS.${file}+= -fno-exceptions -funwind-tables
+.endfor
CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY
.if empty(CXXFLAGS:M-std=*)
Modified: stable/11/lib/libgcc_s/Makefile
==============================================================================
--- head/lib/libgcc_s/Makefile Thu Oct 13 18:57:18 2016 (r307230)
+++ stable/11/lib/libgcc_s/Makefile Mon May 4 22:59:39 2020 (r360643)
@@ -2,13 +2,37 @@
PKG= clibs
SHLIB_NAME= libgcc_s.so.1
+SHLIBDIR?= /lib
WARNS?= 2
LDFLAGS+= -nodefaultlibs
+LIBADD+= c
VERSION_MAP= ${.CURDIR}/Version.map
.include "../libcompiler_rt/Makefile.inc"
.include "../libgcc_eh/Makefile.inc"
+
+# gcc has incompatible internal declarations for __divtc3 and __multc3, but has
+# no option to silence its warning, so make warnings non-fatal.
+NO_WERROR.gcc=
+
+LIBCSRCDIR= ${SRCTOP}/lib/libc
+LIBMSRCDIR= ${SRCTOP}/lib/msun/src
+CFLAGS+= -I${LIBCSRCDIR}/include -I${LIBCSRCDIR}/${MACHINE_CPUARCH}
+CFLAGS+= -I${LIBMSRCDIR}
+.PATH: ${LIBMSRCDIR}
+SRCS+= s_fabs.c
+SRCS+= s_fabsf.c
+SRCS+= s_fabsl.c
+SRCS+= s_fmax.c
+SRCS+= s_fmaxf.c
+SRCS+= s_fmaxl.c
+SRCS+= s_logb.c
+SRCS+= s_logbf.c
+SRCS+= s_logbl.c
+SRCS+= s_scalbn.c
+SRCS+= s_scalbnf.c
+SRCS+= s_scalbnl.c
.include <bsd.lib.mk>
Modified: stable/11/lib/libgcc_s/Version.map
==============================================================================
--- head/lib/libgcc_s/Version.map Thu Oct 13 18:57:18 2016 (r307230)
+++ stable/11/lib/libgcc_s/Version.map Mon May 4 22:59:39 2020 (r360643)
@@ -3,37 +3,55 @@
*/
GCC_3.0 {
+global:
__absvdi2;
__absvsi2;
__addvdi3;
__addvsi3;
+ __ashldi3;
__ashlti3;
+ __ashrdi3;
__ashrti3;
__clear_cache;
+ __cmpdi2;
__cmpti2;
__deregister_frame;
__deregister_frame_info;
__deregister_frame_info_bases;
+ __divdi3;
__divti3;
__ffsdi2;
__ffsti2;
+ __fixdfdi;
__fixdfti;
+ __fixsfdi;
__fixsfti;
__fixunsdfdi;
+ __fixunsdfsi;
__fixunsdfti;
__fixunssfdi;
+ __fixunssfsi;
__fixunssfti;
__fixunsxfdi;
+ __fixunsxfsi;
__fixunsxfti;
+ __fixxfdi;
__fixxfti;
+ __floatdidf;
+ __floatdisf;
+ __floatdixf;
__floattidf;
__floattisf;
__floattixf;
+ __lshrdi3;
__lshrti3;
+ __moddi3;
__modti3;
+ __muldi3;
+ __multi3;
__mulvdi3;
__mulvsi3;
- __multi3;
+ __negdi2;
__negti2;
__negvdi2;
__negvsi2;
@@ -45,9 +63,13 @@ GCC_3.0 {
__register_frame_table;
__subvdi3;
__subvsi3;
+ __ucmpdi2;
__ucmpti2;
+ __udivdi3;
+ __udivmoddi4;
__udivmodti4;
__udivti3;
+ __umoddi3;
__umodti3;
_Unwind_DeleteException;
_Unwind_Find_FDE;
@@ -62,6 +84,8 @@ GCC_3.0 {
_Unwind_Resume;
_Unwind_SetGR;
_Unwind_SetIP;
+local:
+ *;
};
GCC_3.3 {
@@ -77,12 +101,16 @@ GCC_3.3.1 {
GCC_3.4 {
__clzdi2;
+ __clzsi2;
__clzti2;
__ctzdi2;
+ __ctzsi2;
__ctzti2;
__paritydi2;
+ __paritysi2;
__parityti2;
__popcountdi2;
+ __popcountsi2;
__popcountti2;
} GCC_3.3.1;
@@ -111,6 +139,9 @@ GCC_4.0.0 {
} GCC_3.4.4;
GCC_4.2.0 {
+ __floatundidf;
+ __floatundisf;
+ __floatundixf;
__floatuntidf;
__floatuntisf;
__floatuntixf;
More information about the svn-src-stable-11
mailing list