Commit Graph

82 Commits

Author SHA1 Message Date
Alex Richardson
ac175bd33a Install working pkgconfig .pc files for compat libraries
The default ones are install them to /usr/libdata/pkgconfig, and we can't
use this path for compat libraries, so we use /usr/lib<suffix>/pkgconfigi here.

Test Plan:	grep -rn libdir= ./usr/lib32/pkgconfig/*.pc
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D34939
2022-08-11 23:18:34 +01:00
Brooks Davis
724123b9f4 libcompat: Use WORLDTMP sysroot
Now that -m32 is fixed, just install libs in ${WORLDTMP}/lib/lib32
and use the installed headers.

Reviewed by:	imp, jhb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D34697
2022-07-01 08:33:16 +01:00
Warner Losh
03f6e18206 Makefile.libcompat: Sort
Sort MK_BOOT before MK_CTF and remove now-useless NO_LINT while I'm
here.

Suggested by:		brooks, emaste
Sponsored by:		Netflix
2022-02-02 14:34:29 -07:00
Warner Losh
034755623d stand: Fix kboot issue on powerpc64 with MK_LIB32=yes
When MK_LIB32 is true, we descend into stand for make includes, make
clean, etc. We shouldn't do this, so set MK_BOOT=no when we're building
includes.

Fixes:		6497250f6f
PR:		261497
Sponsored by:	Netflix
Reviewed by:	emaste, brooks (he suggested this)
Differential Revision:	https://reviews.freebsd.org/D34141
2022-02-02 14:27:56 -07:00
Warner Losh
aada8c4721 libcompat: Remove MIPS from list of compat libraries
Sponsored by:		Netflix
2021-12-09 08:22:51 -07:00
Baptiste Daroussin
cc46927f8a ncurses: fix libcompat (lib32 for example) building 2021-10-04 14:16:32 +02:00
Mitchell Horne
61ed578ee6 Prefer MK_SSP=no to SSP_CFLAGS=
It is more idiomatic. CFLAGS is only augmented with $SSP_CFLAGS when
$MK_SSP != "no".

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31401
2021-08-04 15:23:22 -03:00
Mitchell Horne
bcd2f41f7d mk: format some option lists
Alphabetize and give each option its own line, ahead of making another
change to these lists. This makes future diffs easier to read.

Reviewed by:	imp, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31399
2021-08-04 15:23:22 -03:00
Alex Richardson
7bc797e3f3 Add build system support for ASAN+UBSAN instrumentation
This adds two new options WITH_ASAN/WITH_UBSAN that can be set to
enable instrumentation of all binaries with AddressSanitizer and/or
UndefinedBehaviourSanitizer. This current patch is almost sufficient
to get a complete buildworld with sanitizer instrumentation but in
order to actually build and boot a system it depends on a few more
follow-up commits.

Reviewed By:	brooks, kib, markj
Differential Revision: https://reviews.freebsd.org/D31043
2021-08-02 14:33:24 +01:00
Wolfram Schneider
99feb137f5 `make buildworld' with time logging for each stage
PR:	 	257141
Reviewed by:	sjg,emaste
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D31154
2021-08-01 09:10:49 +00:00
Mitchell Horne
689c7e7975 libpmc: always generate libpmc_events.c
The jevents build tool will create an empty table if it doesn't find any
events, so we can remove the extra $MACHINE_CPUARCH checks.

Reviewed by:	gnn, ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30531
2021-05-31 17:39:05 -03:00
Baptiste Daroussin
8537f16249 libcompat: remove redundant path for ncurses
Reported by:	kevans
2021-01-07 15:14:52 +01:00
Alex Richardson
7fa2f2a62f Rename NO_WERROR -> MK_WERROR=no
As suggested in D27598. This also supports MK_WERROR.clang=no and
MK_WERROR.gcc=no to support the existing NO_WERROR.<compiler> uses.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D27601
2021-01-07 09:31:03 +00:00
Alex Richardson
94ffff68c8 Stop passing MK_WARNS=no for bootstrap tools
I got annoyed by the number of warnings that the CheriBSD build was
emitting. It turns out that we are emitting lots of warnings during
bootstrap because bootstrap tools are built with the default compiler
flags and ignore the warnings flags that are set in bsd.sys.mk.

Looking at git blame, it appears that MK_WARNS=no has been passed since
rS112869, replacing the -DNO_WERROR option that was added in rS87775.

This commit changes MK_WARNS=no back to -DNO_WERROR. We need to pass
-DNO_WERROR, since the system compiler might have new warnings that we
don't know about yet, and we shouldn't fail the build in that case.

Reviewed By:	imp, brooks
Differential Revision: https://reviews.freebsd.org/D27598
2021-01-07 09:31:03 +00:00
Baptiste Daroussin
821aa63a09 ncurses: only keep the version with widechar support
Only keep the widechar version of ncurses as libncursesw.so.9

Keep the old name to avoid breaking the ABI compatibility (the non
widechar version libncurses.so.9 is not binary compatible with
libncursesw.so.9) since all ports and base are already only linking
against the widechar version we can simply remove libncurses.so.9

Since the .9 version only lived in the dev branch and never ended in a
release, it is simply removed and not added to any binary compat
package.

Add symlinks to keep build time compatibility for anyone linking against
-lncurses
2021-01-05 14:01:32 +01:00
Warner Losh
7eb9f7558c Race in 32-bit fixed
Use install insteald of install.sh for 32-bit builds to fight races there.

Reviewed by: markj
2020-10-08 17:30:05 +00:00
Ed Maste
7576679986 Add WITH_/WITHOUT_CLEAN option to replace NO_CLEAN
This allows use of the standard src.conf configuration for controlling
whether the tree is cleaned before build or not.  The default is still
to clean.

Setting either NOCLEAN or NO_CLEAN will mention the new src.conf option.
NOCLEAN remains a .warning, while for now NO_CLEAN is .info.

Reviewed by:	bdrewery (earlier version)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22762
2020-09-08 00:44:35 +00:00
Emmanuel Vadot
eb61f7bdf2 Stop building libl and liby
Those libs aren't needed anymore so stop building them for the bootstrap tools
or the compat libs.

Reviewed by:	bapt, emaste
X-Differential Revision:	D24171
2020-03-26 08:23:09 +00:00
Brooks Davis
a4330302f2 libcompat: build 32-bit rtld and ldd as part of "everything"
Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.

Alter .PATH and CFLAGS settings in work when the Makefile is included.

While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.

The net effect of this change is to make Makefile.libcompat only build
compatability libraries.

Changes relative to r354449:

Correct detection of the compiler type when bsd.compat.mk is used
outside Makefile.libcompat.  Previously it always matched the clang
case.

Set LDFLAGS including the linker emulation for mips where -m32 seems to
be insufficent.

Reviewed by:	imp, kib (origional version in r354449)
Obtained from:	CheriBSD (conceptually)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22251
2019-11-07 22:58:10 +00:00
Brooks Davis
ccad77fe1e Revert r354449: libcompat: build 32-bit rtld and ldd as part of "everything"
Additional testing is required..
2019-11-07 19:22:51 +00:00
Brooks Davis
36712a9497 libcompat: build 32-bit rtld and ldd as part of "everything"
Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.

Alter .PATH and CFLAGS settings in work when the Makefile is included.

While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.

The net effect of this change is to make Makefile.libcompat only build
compatability libraries.

Reviewed by:	imp, kib
Obtained from:	CheriBSD (conceptually)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22251
2019-11-07 17:10:33 +00:00
Brooks Davis
5dab131339 Build compat libraries before "everything".
This is required for us to link programs against compat versions of
libraries.

Reviewed by:	bdrewery, jhb
Sponsored by:	DARPA, AFRL
2019-10-15 21:22:13 +00:00
Brooks Davis
bbcf7edd98 Move the per-ARCH definitions to bsd.compat.mk.
This is the first step if refactoring the definitions to allow programs
to be selectively linked against libcompat libraries.

Reviewed by:	bdrewery
Sponsored by:	DARPA, AFRL
2019-10-15 21:08:49 +00:00
Brooks Davis
571fc82c92 Centralize adding OBJCOPY=${XOBJCOPY} to LIB32WMAKEFLAGS.
Reviewed by:	emaste, imp
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21983
2019-10-11 21:28:02 +00:00
Ed Maste
78aee653e9 libsysdecode: use the proper include directory
Reported by:	cy
Reviewed by:	lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21068
2019-07-25 17:10:17 +00:00
Li-Wen Hsu
99c2d8c27d Workaround the build failure on platforms have lib32 after r350301
Error message:

make[5]: make[5]: don't know how to make /usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/sys/netinet/in.h. Stop

make[5]: stopped in /usr/src/lib/libsysdecode

Sponsored by:	The FreeBSD Foundation
2019-07-25 07:57:01 +00:00
Tijl Coosemans
89ebdc9454 Build lib32 libl. The library is built from usr.bin/lex/lib. It would be
better to move this directory to lib/libl, but this requires more extensive
changes to Makefile.inc1.  This simple fix can be MFCed quickly.

PR:		238874
Reviewed by:	imp
MFC after:	3 days
2019-06-29 17:01:56 +00:00
Brooks Davis
23d772ee4e Use ...-freebsd13.0 in -target strings.
Reported by:	Mark Millard
2018-11-12 16:55:20 +00:00
Ed Maste
01b7ad0400 libcompat: disable retpoline when building build tools
These are built with the host toolchain which may not support retpoline.
While here, move the MK_ overrides to a separate line and sort them
alphabetically to support future changes.

MFC with:	r339511
Sponsored by:	The FreeBSD Foundation
2018-11-03 19:31:11 +00:00
Alex Richardson
a00cd9540d Fix non-FreeBSD host lib32 build for TARGET=amd64
When building on non-FreeBSD systems we need to pass an explicit target
triple to clang otherwise it will attempt to build with the host triple.
This also has advantages when building on a FreeBSD host: we now tell
clang that we are targeting at least FreeBSD 12.0 instead of an older
version so it can enable newer features.

Reviewed By:	brooks (mentor)
Approved By:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D16842
2018-08-23 18:19:10 +00:00
John Baldwin
52f9bacb0e Install the 32-bit compat sanitizer libraries.
The lib32 build was already building the i386 version of
the clang sanitizers (libclang_rt) but they were not being
installed.  This enables the installation.

MK_TOOLCHAIN=no was originally added to the install make
environment to disable includes so that NO_INCS could be
removed.  The MK_TOOLCHAIN in bsd.incs.mk was subsequently
renamed to MK_INCLUDES, but bsd.lib.mk doesn't even include
bsd.incs.mk when LIBRARIES_ONLY is defined which the install
make environment for compat libs now defines.  However,
setting MK_TOOLCHAIN=no forced MK_CLANG=no which disabled
libclang_rt during the install32 phase.  Remove MK_TOOLCHAIN=no
since LIBRARIES_ONLY is now sufficient.

Since the libcompat environment overrides both LIBDIR and
SHLIBDIR, libclang_rt/Makefile.inc has to set both variables
to force the libraries to be installed to the location
expected by the compiler.

Reviewed by:	bdrewery, dim
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16574
2018-08-03 18:52:51 +00:00
Ed Maste
0d84986542 Makefile.libcompat: correctly append to make variable
Reported by:	hselasky
Pointy hat to:	emaste
2018-07-30 14:42:59 +00:00
Ed Maste
ad91146c66 Makefile.libcompat: use one variable assignment per line
This makes it easier to carry or merge patches that remove gnu/
components.
2018-07-30 14:28:00 +00:00
Alex Richardson
55a5b46aff Don't change directory owner to root when building with -DNO_ROOT
Currently the mtree calls in Makefile.inc1 all change the directory owner
to match the spec file. However, we should not be doing this during
distributeworld if -DNO_ROOT is passed. Additionally, when creating the
WORLDTMP directory hierachy there is no need to change the owner to root so
we now always pass the -W flag when populating WORLDTMP.

This is also required for building FreeBSD on Linux/Mac since the required
groups/users will not exist there which is how I discovered this issue.

Reviewed By:	emaste, bdrewery, imp
Approved By:	brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D14185
2018-06-29 21:15:26 +00:00
John Baldwin
151578dc5f Remove the various build flag hacks for GCC cross-compile.
The xtoolchain GCC packages have not required these flags since ports
commits r465416 and r466701.  The in-tree GCC 4.2.1 has also been patched
in r335716 and r335717 to correctly honor --sysroot when looking for
includes and libraries.

Reviewed by:	bdrewery
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D16055
2018-06-28 21:26:14 +00:00
Bryan Drewery
6e6be2bbe2 Reduce exec and fstat overhead for non-build targets.
This is mostly targetting 'make showconfig' and 'make test-system-*' for
the benefit of makeman and universe-one-clang work.

Sponsored by:	Dell EMC
2018-06-20 17:20:39 +00:00
Bryan Drewery
c4273800ae lib32: Fix lib/libpmc/pmu-events files ending up in source directory.
This could happen with either WITHOUT_AUTO_OBJ=yes or MAKELEVEL>0 for
the initial 'make buildworld' command.

This now ensures that build-tools targets have 'make obj' ran if needed.

This is especially problematic for pmu-events since it is not directly
connected in the build.  Normally the 'make includes' call right before
this implicitly creates the objdir with a 'make obj' already but
misses pmu-events because it is disconnected from lib/libpmc.  Fixing that
would make this new 'make obj' pointless but it is being added to avoid
this problem in the future should another tool be connected like this.

Reported by:	rgrimes, kib, kevans
Sponsored by:	Dell EMC
2018-06-15 18:50:24 +00:00
Bryan Drewery
127b666cd1 libcompat: Only build libmagic build tool if MK_FILE is yes.
Sponsored by:	Dell EMC
2018-06-15 17:03:57 +00:00
Bryan Drewery
6f1f2b1931 Only build jevents if MK_PMC is yes and only for amd64 in libcompat.
Sponsored by:	Dell EMC
2018-06-15 16:48:09 +00:00
Matt Macy
7d1c2b74a0 libpmc/pmu: enable for i386 as well 2018-05-31 22:26:55 +00:00
Bryan Drewery
1c0cac23cf X_COMPILER_* may not be defined.
Sponsored by:	Dell EMC
2018-01-24 18:08:37 +00:00
John Baldwin
a1554bba05 Check for GCC first rather than clang in the MIPS lib32 rules.
This works around a bug with X_COMPILER_TYPE and permits mips64 to build
again with in-tree gcc as well as clang and external gcc.

Sponsored by:	DARPA / AFRL
2018-01-16 01:05:04 +00:00
John Baldwin
8d286bb992 Allow MIPS lib32 to build with clang.
Don't try to set -march as clang doesn't permit use of the O32 ABI
with newer CPU microarchitectures like 'mips3'.  In addition, clang
doesn't permit the O32 ABI with the default N64 target, so use an
explicit O32 -target for clang.

Sponsored by:	DARPA / AFRL
2018-01-11 19:24:44 +00:00
Bryan Drewery
996e475962 Fix nested MAKEOBJDIRPREFIX breaking various release/buildworld/toolchain targets.
This problem was caused by r325329 and r325350.

For the release(7) targets, some will run mm-mtree.sh which itself runs make
with a MAKEOBJDIRPREFIX.  The execution of that script leaks OBJROOT,
MAKEOBJDIR, and MAKELEVEL=1 in the environment.  This causes the mm-mtree makes
to not do some basic setup of OBJROOT and only use this special
MAKEOBJDIRPREFIX case which fails to empty out MAKEOBJDIRPREFIX for further
nested makes, such as a tree walk.  If that tree walk sets OBJROOT/OBJTOP such
as r325329 is doing, then the wrong OBJDIRs end up being used due to the
unemptied MAKEOBJDIRPREFIX being preferred over the proper MAKEOBJDIR.

Pointyhat to:	bdrewery
Sponsored by:	Dell EMC Isilon
2017-11-05 00:11:51 +00:00
Bryan Drewery
1031b94fc4 Set OBJROOT/OBJTOP as make arguments. Missed in r325329.
Sponsored by:	Dell EMC Isilon
2017-11-05 00:11:47 +00:00
Bryan Drewery
4dc89c4d51 Reduce MAKEOBJDIRPREFIX path spam by specifying a direct objdir to use.
Sponsored by:	Dell EMC Isilon
2017-11-02 18:08:36 +00:00
Bryan Drewery
dfa099890c Add option UNIFIED_OBJDIR, on by default, which moves the default build OBJDIR.
This changes the build OBJDIR from the older style of /usr/obj/<srcdir> for
native builds, and /usr/obj/<target>.<target_arch>/<srcdir> for cross builds to
a new simpler format of /usr/obj/<srcdir>/<target>.<target_arch>.  This
new format is used regardless of cross or native build.  It allows
easier management of multiple source tree object directories.

The UNIFIED_OBJDIR option will be removed and its feature made permanent
for the 12.0 release.

Relnotes:	yes (don't note UNIFIED_OBJDIR option since it will be removed)
Prior work:	D3711 D874
Reviewed by:	gjb, sjg
Discussed at:	https://lists.freebsd.org/pipermail/freebsd-arch/2016-May/017805.html
Discussed with:	emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12840
2017-11-01 21:22:05 +00:00
Bryan Drewery
2aba4f29f9 lib32/libsoft: Store object files in a more consistent structure.
Having objects in world32 and a sysroot in lib32 was confusing and
inconsistent with the normal build.  Now objects are stored in
obj-lib32 (or obj-libsoft) and the sysroot (analagous to WORLDTMP)
is stored in obj-lib32/tmp.

Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:39 +00:00
Bryan Drewery
67d2f51ad6 Move some LIBCOMPAT tmpdir logic setup to its own build target.
Its own build target was already handling mtree extractions
just as _worldtmp did, so the other cleaning of the
tmpdir makes sense here as well.

Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:02 +00:00
Warner Losh
0b972ac92e Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Differential Revision: https://reviews.freebsd.org/D12010
2017-10-05 23:01:33 +00:00