git: 7a171e30836d - main - test-includes: Build a library instead of a binary
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Dec 2021 22:35:57 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=7a171e30836d1aa9870489e692f0ed56fbd45756
commit 7a171e30836d1aa9870489e692f0ed56fbd45756
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-12-15 22:34:47 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-12-15 22:35:24 +0000
test-includes: Build a library instead of a binary
We need to build the .o's, but don't need to link. Build a static
library instead of a binary to accmoplish this. This removes the need to
have all the libc and crt stuff built, which is required for a
binary. In addition, trying to build a non-standard binary runs into
trouble with undefined symbols on arm related to EABI, even when using a
simplified startup with -nostdlib -e start.
Turn back on testing includes, now that it works.
Sponsored by: Netflix
Reviewed by: brooks, markj (prior version)
Differential Revision: https://reviews.freebsd.org/D33452
---
Makefile.inc1 | 1 +
tools/build/test-includes/Makefile | 10 ++++++----
tools/build/test-includes/test-includes.c | 7 -------
3 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/Makefile.inc1 b/Makefile.inc1
index e03588511954..963ffac7d09b 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1128,6 +1128,7 @@ _includes:
.if !empty(SUBDIR_OVERRIDE) && make(buildworld)
${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes
.endif
+ ${_+_}cd ${.CURDIR}; ${WMAKE} test-includes
_libraries:
@echo
@echo "--------------------------------------------------------------"
diff --git a/tools/build/test-includes/Makefile b/tools/build/test-includes/Makefile
index b42497e0397d..b1e5023663af 100644
--- a/tools/build/test-includes/Makefile
+++ b/tools/build/test-includes/Makefile
@@ -13,11 +13,11 @@
# programs to detect FreeBSD has different headers, omitting internal
# headers cuts down on the noise w/o causing problems for the goal.
#
-PROG= test-includes
-SRCS= test-includes.c
-INTERNALPROG= This is a compile-only test
+LIB= test-includes
+INTERNALLIB= This is a compile-only test
MAN=
HDRS!= (cd ${SRCTOP}/sys; ls sys/[^_]*.h net*/[^_]*.h)
+NO_PIC= yes
# Some files have to be clean for extra defines too...
CFLAGS.event.c= -D_WANT_KEVENT32 -D_WANT_FREEBSD11_KEVENT
@@ -33,6 +33,8 @@ ${h:R}.c:
.endif
.endfor
+test-includes: lib${LIB}.a .PHONY
+
#
# Target to make the current known bad list. In general, this list should only
# ever shrink and never grow.
@@ -49,4 +51,4 @@ badfiles.inc:
done; \
echo) > ${.CURDIR}/badfiles.inc
-.include <bsd.prog.mk>
+.include <bsd.lib.mk>
diff --git a/tools/build/test-includes/test-includes.c b/tools/build/test-includes/test-includes.c
deleted file mode 100644
index 5518813d8f18..000000000000
--- a/tools/build/test-includes/test-includes.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Public domain */
-
-int
-main(void)
-{
- return 0;
-}