diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2015-11-25 19:44:51 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2015-11-25 19:44:51 +0000 |
commit | cbc5242afd27883fc700d661c55fd6bf3b0f50f2 (patch) | |
tree | 6f111423884fb2c8c82e0def32b067c17e66183c | |
parent | 52255645fb90fea4463237052ca49411638d381a (diff) | |
download | FreeBSD-src-cbc5242afd27883fc700d661c55fd6bf3b0f50f2.zip FreeBSD-src-cbc5242afd27883fc700d661c55fd6bf3b0f50f2.tar.gz |
META MODE: Fix 'make bootstrap-tools'.
The main problem was bitrot after elftoolchain being swapped in for the
GNU toolchain.
This also reworks how the list of 'host allowed' libraries is determined
to only allow INTERNALLIBs, which is needed for libelftc to come in.
For usr.bin/readelf use the same hack, as libelf and libdward, to bring in
the needed sys/ headers for host builds. This has not yet been a problem due
to readelf not being built as a host tool in buildworld. This is possible
in the meta build though when building the toolchain.
Sponsored by: EMC / Isilon Storage Division
-rw-r--r-- | lib/libdwarf/Makefile | 2 | ||||
-rw-r--r-- | lib/libelf/Makefile | 2 | ||||
-rw-r--r-- | lib/liblzma/Makefile.depend | 1 | ||||
-rw-r--r-- | lib/libmd/Makefile.depend.host | 3 | ||||
-rw-r--r-- | share/mk/local.dirdeps.mk | 21 | ||||
-rw-r--r-- | share/mk/local.gendirdeps.mk | 11 | ||||
-rw-r--r-- | share/mk/src.libnames.mk | 4 | ||||
-rw-r--r-- | targets/pseudo/bootstrap-tools/Makefile | 2 | ||||
-rw-r--r-- | targets/pseudo/toolchain/Makefile.depend | 36 | ||||
-rw-r--r-- | usr.bin/cxxfilt/Makefile.depend | 20 | ||||
-rw-r--r-- | usr.bin/readelf/Makefile | 14 | ||||
-rw-r--r-- | usr.bin/xinstall/Makefile.depend.host | 1 |
12 files changed, 74 insertions, 43 deletions
diff --git a/lib/libdwarf/Makefile b/lib/libdwarf/Makefile index 30e0c60..bd98d8f 100644 --- a/lib/libdwarf/Makefile +++ b/lib/libdwarf/Makefile @@ -76,7 +76,7 @@ SRCS= \ INCS= dwarf.h libdwarf.h -# +# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile # We need to link against the correct version of these files. One # solution is to include ../../sys in the include path. This causes # problems when a header file in sys depends on a file in another diff --git a/lib/libelf/Makefile b/lib/libelf/Makefile index 91dbea6f1..b8aa4df 100644 --- a/lib/libelf/Makefile +++ b/lib/libelf/Makefile @@ -65,7 +65,7 @@ SRCS= elf.c \ INCS= libelf.h gelf.h -# +# This same hack is in lib/libdwarf/Makefile and usr.bin/readelf/Makefile # We need to link against the correct version of these files. One # solution is to include ../../sys in the include path. This causes # problems when a header file in sys depends on a file in another diff --git a/lib/liblzma/Makefile.depend b/lib/liblzma/Makefile.depend index 6f716c2..7b92dbd 100644 --- a/lib/liblzma/Makefile.depend +++ b/lib/liblzma/Makefile.depend @@ -7,7 +7,6 @@ DIRDEPS = \ include \ include/xlocale \ lib/${CSU_DIR} \ - lib/clang/include.host \ lib/libc \ lib/libcompiler_rt \ lib/libthr \ diff --git a/lib/libmd/Makefile.depend.host b/lib/libmd/Makefile.depend.host index 771b816..fd7c8da 100644 --- a/lib/libmd/Makefile.depend.host +++ b/lib/libmd/Makefile.depend.host @@ -2,9 +2,6 @@ # Autogenerated - do NOT edit! DIRDEPS = \ - gnu/usr.bin/binutils/ld \ - gnu/usr.bin/binutils/nm \ - usr.bin/xinstall \ .include <dirdeps.mk> diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index d83e3e8..53c176e 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -28,15 +28,20 @@ DIRDEPS_FILTER+= N*.host .for m in host common M_dep_qual_fixes += C;($m),[^/.,]*$$;\1; .endfor - #.info M_dep_qual_fixes=${M_dep_qual_fixes} -# we want to supress these dependencies for host tools -# but some libs are sadly needed. -_need_host_libs= \ - lib/libc++ \ - lib/libcxxrt \ - lib/libdwarf \ - lib/libmd \ + +# Cheat for including src.libnames.mk +__<bsd.init.mk>__: +# Pull in _INTERNALLIBS +.include <src.libnames.mk> + +# Host libraries should mostly be excluded from the build so the +# host version in /usr/lib is used. Internal libraries need to be +# allowed to be built though since they are never installed. +_need_host_libs= +.for lib in ${_INTERNALLIBS} +_need_host_libs+= ${LIB${lib:tu}DIR:S,^${ROOTOBJDIR}/,,} +.endfor N_host_libs:= ${cd ${SRCTOP} && echo lib/lib*:L:sh:${_need_host_libs:${M_ListToSkip}}:${M_ListToSkip}} DIRDEPS_FILTER.host = \ diff --git a/share/mk/local.gendirdeps.mk b/share/mk/local.gendirdeps.mk index a790cbc..dc65d16 100644 --- a/share/mk/local.gendirdeps.mk +++ b/share/mk/local.gendirdeps.mk @@ -14,6 +14,7 @@ GENDIRDEPS_FILTER+= \ Ntargets/pseudo/stage* \ Ntools/* +# Exclude toolchain which is handled special. .if ${RELDIR:Mtargets*} == "" .if ${RELDIR:Nusr.bin/clang/*:Ngnu/usr.bin/cc/*:Nlib/clang*} != "" GENDIRDEPS_FILTER.host+= \ @@ -22,7 +23,17 @@ GENDIRDEPS_FILTER.host+= \ .endif GENDIRDEPS_FILTER+= \ + Nlib/clang/include.host \ + Nusr.bin/addr2line.host \ + Nusr.bin/ar.host \ Nusr.bin/clang/clang.host \ + Nusr.bin/elfcopy.host \ + Nusr.bin/elfdump.host \ + Nusr.bin/nm.host \ + Nusr.bin/readelf.host \ + Nusr.bin/size.host \ + Nusr.bin/strings.host \ + Nusr.bin/strip.host \ Ngnu/usr.bin/cc* \ Ngnu/usr.bin/binutils*.host \ diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index d78d6e2..94d41e8 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -7,6 +7,9 @@ .error src.libnames.mk cannot be included directly. .endif +.if !target(__<src.libnames.mk>__) +__<src.libnames.mk>__: + .include <src.opts.mk> .if ${.OBJDIR:S,${.CURDIR},,} != ${.OBJDIR} @@ -368,3 +371,4 @@ LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools.a LIBAMUDIR= ${ROOTOBJDIR}/usr.sbin/amd/libamu LIBAMU?= ${LIBAMUDIR}/libamu/libamu.a +.endif # !target(__<src.libnames.mk>__) diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile index 8d90d1c..f196c8a 100644 --- a/targets/pseudo/bootstrap-tools/Makefile +++ b/targets/pseudo/bootstrap-tools/Makefile @@ -62,7 +62,7 @@ cross-tools build-tools bootstrap-tools: .MAKE .META touch $@ # MAKELEVEL=0 so that dirdeps.mk does its thing -# LEGACY_TOOLS lets us use the bootstaped stuff above +# LEGACY_TOOLS lets us use the bootstrapped stuff above # TARGET* is so that MK_CLANG gets set correctly. BSTCENV= \ MAKELEVEL=0 \ diff --git a/targets/pseudo/toolchain/Makefile.depend b/targets/pseudo/toolchain/Makefile.depend index 827e3f9..c3af1f1 100644 --- a/targets/pseudo/toolchain/Makefile.depend +++ b/targets/pseudo/toolchain/Makefile.depend @@ -5,44 +5,26 @@ .if !defined(MK_CLANG) .include "${SRCTOP}/share/mk/src.opts.mk" .endif -DIRDEPS= -.if ${MK_TOOLCHAIN} == "yes" -DIRDEPS+= \ +DIRDEPS= \ + gnu/usr.bin/binutils/as \ + gnu/usr.bin/binutils/ld \ usr.bin/addr2line \ - usr.bin/cxxflit \ + usr.bin/ar \ + usr.bin/cxxfilt \ usr.bin/elfcopy \ + usr.bin/elfdump \ usr.bin/nm \ usr.bin/readelf \ usr.bin/size \ - usr.bin/strip \ usr.bin/strings \ - -.else -DIRDEPS+= \ - gnu/usr.bin/binutils/addr2line \ - gnu/usr.bin/binutils/nm \ - gnu/usr.bin/binutils/readelf \ - gnu/usr.bin/binutils/size \ - gnu/usr.bin/binutils/strip \ - gnu/usr.bin/binutils/strings \ - -.endif - -DIRDEPS+= \ + usr.bin/strip \ usr.bin/xinstall \ - gnu/usr.bin/binutils/ar \ - gnu/usr.bin/binutils/as \ - gnu/usr.bin/binutils/ld \ - gnu/usr.bin/binutils/objcopy \ - gnu/usr.bin/binutils/objdump \ - gnu/usr.bin/binutils/ranlib \ - -.if ${MK_CLANG} == "yes" +.if ${MK_CLANG_BOOTSTRAP} == "yes" DIRDEPS+= targets/pseudo/clang .endif -.if ${MK_GCC} == "yes" +.if ${MK_GCC_BOOTSTRAP} == "yes" DIRDEPS+= targets/pseudo/gcc .endif diff --git a/usr.bin/cxxfilt/Makefile.depend b/usr.bin/cxxfilt/Makefile.depend new file mode 100644 index 0000000..40241f3 --- /dev/null +++ b/usr.bin/cxxfilt/Makefile.depend @@ -0,0 +1,20 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libelf \ + lib/libelftc \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/readelf/Makefile b/usr.bin/readelf/Makefile index e5d7401..f865a97 100644 --- a/usr.bin/readelf/Makefile +++ b/usr.bin/readelf/Makefile @@ -6,9 +6,23 @@ READELFDIR= ${ELFTCDIR}/readelf .PATH: ${READELFDIR} PROG= readelf +SRCS= readelf.c LIBADD= dwarf elftc elf CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common +# This same hack is in lib/libelf/Makefile and lib/libdward/Makefile +# We need to link against the correct version of these files. One +# solution is to include ../../sys in the include path. This causes +# problems when a header file in sys depends on a file in another +# part of the tree, e.g. a machine dependent header. +# +SRCS+= sys/elf32.h sys/elf64.h sys/elf_common.h +CLEANDIRS= sys +CFLAGS+= -I. +sys/elf32.h sys/elf64.h sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA + mkdir -p ${.OBJDIR}/sys + ln -sf ${.ALLSRC} ${.TARGET} + .include <bsd.prog.mk> diff --git a/usr.bin/xinstall/Makefile.depend.host b/usr.bin/xinstall/Makefile.depend.host index abd0b21..35734ab 100644 --- a/usr.bin/xinstall/Makefile.depend.host +++ b/usr.bin/xinstall/Makefile.depend.host @@ -2,7 +2,6 @@ # Autogenerated - do NOT edit! DIRDEPS = \ - gnu/usr.bin/binutils/ld \ lib/libmd \ |