From b79f25753346a577c9ba0a3dca69bd9d9d72a020 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 6 Dec 2024 04:44:05 +0800 Subject: Add TEST_CC and TEST_CXX support Support testing glibc build with a different C compiler or a different C++ compiler with $ ../glibc-VERSION/configure TEST_CC="gcc-6.4.1" TEST_CXX="g++-6.4.1" 1. Add LIBC_TRY_CC_AND_TEST_CC_OPTION, LIBC_TRY_CC_AND_TEST_CC_COMMAND and LIBC_TRY_CC_AND_TEST_LINK to test both CC and TEST_CC. 2. Add check and xcheck targets to Makefile.in and override build compiler options with ones from TEST_CC and TEST_CXX. Tested on Fedora 41/x86-64: 1. Building with GCC 14.2.1 and testing with GCC 6.4.1 and GCC 11.2.1. 2. Building with GCC 15 and testing with GCC 6.4.1. Support for GCC versions older than GCC 6.2 may need to change the test sources. Other targets may need to update configure.ac under sysdeps and modify Makefile.in to override target build compiler options. Signed-off-by: H.J. Lu Reviewed-by: Sam James --- Makefile.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Makefile.in') diff --git a/Makefile.in b/Makefile.in index 3fe9e73645..ee9270491e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,17 @@ srcdir = @srcdir@ +TEST_CC = @TEST_CC@ +TEST_CXX = @TEST_CXX@ +test-cc-option-wimplicit-fallthrough = @libc_cv_test_cc_wimplicit_fallthrough@ +test-config-cflags-mprefer-vector-width = @libc_cv_test_cc_mprefer_vector_width@ +test-config-cflags-signaling-nans = @libc_cv_test_cc_signaling_nans@ +test-config-cflags-wno-ignored-attributes = @libc_cv_test_wno_ignored_attributes@ +test-enable-cet = @test_enable_cet@ +test-have-mamx-tile = @libc_cv_test_x86_have_amx_tile@ +test-have-mtls-descriptor = @libc_cv_test_mtls_descriptor@ +test-have-static-pie = @libc_cv_test_static_pie@ +test-supported-fortify = @libc_cv_test_supported_fortify_source@ + # Uncomment the line below if you want to do parallel build. # PARALLELMFLAGS = -j 4 @@ -8,6 +20,20 @@ srcdir = @srcdir@ all .DEFAULT: $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@ +check xcheck: + $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) \ + CC="$(TEST_CC)" CXX="$(TEST_CXX)" \ + cc-option-wimplicit-fallthrough="$(test-cc-option-wimplicit-fallthrough)" \ + config-cflags-mprefer-vector-width="$(test-config-cflags-mprefer-vector-width)" \ + config-cflags-signaling-nans="$(test-config-cflags-signaling-nans)" \ + config-cflags-wno-ignored-attributes="$(test-config-cflags-wno-ignored-attributes)" \ + enable-cet="$(test-enable-cet)" \ + have-mamx-tile="$(test-have-mamx-tile)" \ + have-mtls-descriptor="$(test-have-mtls-descriptor)" \ + have-static-pie="$(test-have-static-pie)" \ + supported-fortify="$(test-supported-fortify)" \ + objdir=`pwd` $@ + install: LC_ALL=C; export LC_ALL; \ $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@ -- cgit v1.2.3