From a160cbfa073e8499026063d2d3882b2117b4ced7 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Tue, 31 Oct 2017 00:03:36 +0000 Subject: [PATCH] DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND The dependency on gnu/lib/libgcc or lib/libgcc* is determined at 'make dirdeps' time. Sponsored by: Dell EMC Isilon --- lib/libgcc_eh/Makefile.depend | 13 +++++++++++++ lib/libgcc_eh/Makefile.inc | 3 ++- lib/libgcc_s/Makefile.depend | 16 ++++++++++++++++ share/mk/local.dirdeps.mk | 15 ++++++++++++++- share/mk/local.gendirdeps.mk | 3 +++ targets/pseudo/userland/gnu/Makefile.depend | 5 ++++- targets/pseudo/userland/lib/Makefile.depend | 6 ++++++ 7 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 lib/libgcc_eh/Makefile.depend create mode 100644 lib/libgcc_s/Makefile.depend diff --git a/lib/libgcc_eh/Makefile.depend b/lib/libgcc_eh/Makefile.depend new file mode 100644 index 000000000000..18be76b0cb6f --- /dev/null +++ b/lib/libgcc_eh/Makefile.depend @@ -0,0 +1,13 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/xlocale \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/lib/libgcc_eh/Makefile.inc b/lib/libgcc_eh/Makefile.inc index 6337f3890e18..d69084f059cf 100644 --- a/lib/libgcc_eh/Makefile.inc +++ b/lib/libgcc_eh/Makefile.inc @@ -29,7 +29,8 @@ CXXFLAGS+= -std=c++11 .endif CXXFLAGS+= -fno-rtti STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC +# Probably need to just move this earlier or use CXXFLAGS .if ${MK_DIRDEPS_BUILD} == "yes" # Avoid dependency on lib/libc++ -CFLAGS+= -I${SRCTOP}/contrib/libc++/include +CFLAGS+= -isystem ${SRCTOP}/contrib/libc++/include -nostdinc++ .endif diff --git a/lib/libgcc_s/Makefile.depend b/lib/libgcc_s/Makefile.depend new file mode 100644 index 000000000000..2f6d8d110c49 --- /dev/null +++ b/lib/libgcc_s/Makefile.depend @@ -0,0 +1,16 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index fd675a9fcb08..45581da7c0a7 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -76,6 +76,19 @@ DIRDEPS += \ cddl/usr.bin/ctfmerge.host .endif +# Add in proper libgcc (gnu or LLVM) if not building libcc and libc is needed. +# Add both gcc_s and gcc_eh as dependencies as the decision to build +# -static or not is not known here. +.if ${DEP_RELDIR:M*libgcc*} == "" && ${DIRDEPS:Mlib/libc} +.if ${MK_LLVM_LIBUNWIND} == "yes" +DIRDEPS+= \ + lib/libgcc_eh \ + lib/libgcc_s +.else +DIRDEPS+= gnu/lib/libgcc +.endif +.endif + # Bootstrap support. Give hints to DIRDEPS if there is no Makefile.depend* # generated yet. This can be based on things such as SRC files and LIBADD. # These hints will not factor into the final Makefile.depend as only what is @@ -124,7 +137,6 @@ _SRCS= ${SRCS} ${_PROGS_SRCS} # Has C files. The C_DIRDEPS are shared with C++ files as well. C_DIRDEPS= \ gnu/lib/csu \ - gnu/lib/libgcc \ include \ include/arpa \ include/protocols \ @@ -135,6 +147,7 @@ C_DIRDEPS= \ lib/libc \ lib/libcompiler_rt \ +# libgcc is needed as well but is added later. .if ${MK_GSSAPI} != "no" C_DIRDEPS+= include/gssapi diff --git a/share/mk/local.gendirdeps.mk b/share/mk/local.gendirdeps.mk index 5df941602f77..009e10d8d494 100644 --- a/share/mk/local.gendirdeps.mk +++ b/share/mk/local.gendirdeps.mk @@ -10,6 +10,9 @@ GENDIRDEPS_FILTER+= \ Ngnu/lib/libssp/libssp_nonshared \ Ncddl/usr.bin/ctf* \ Nlib/libc_nonshared \ + Ngnu/lib/libgcc \ + Nlib/libgcc_eh \ + Nlib/libgcc_s \ Ntargets/pseudo/stage* \ Ntools/* diff --git a/targets/pseudo/userland/gnu/Makefile.depend b/targets/pseudo/userland/gnu/Makefile.depend index 5929ca4612c1..00c280e9e42e 100644 --- a/targets/pseudo/userland/gnu/Makefile.depend +++ b/targets/pseudo/userland/gnu/Makefile.depend @@ -9,7 +9,6 @@ DIRDEPS = \ gnu/lib/csu \ gnu/lib/libdialog \ - gnu/lib/libgcc \ gnu/lib/libgcov \ gnu/lib/libgomp \ gnu/lib/libreadline/history/doc \ @@ -45,4 +44,8 @@ DIRDEPS = \ DIRDEPS+= gnu/usr.bin/dtc .endif +.if ${MK_LLVM_LIBUNWIND} == "no" +DIRDEPS+= gnu/lib/libgcc +.endif + .include diff --git a/targets/pseudo/userland/lib/Makefile.depend b/targets/pseudo/userland/lib/Makefile.depend index 2735e3b8ca15..a1b9769749b5 100644 --- a/targets/pseudo/userland/lib/Makefile.depend +++ b/targets/pseudo/userland/lib/Makefile.depend @@ -224,6 +224,12 @@ DIRDEPS+= lib/libgpio DIRDEPS+= lib/libefivar .endif +.if ${MK_LLVM_LIBUNWIND} != "no" +DIRDEPS+= \ + lib/libgcc_eh \ + lib/libgcc_s +.endif + .if ${MK_OFED} != "no" DIRDEPS+= \ contrib/ofed/usr.lib/libcxgb4 \