From patchwork Thu Apr 20 19:11:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 752967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w87lZ2Dj9z9ryk for ; Fri, 21 Apr 2017 05:11:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="oRzfAgBB"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :cc:subject:date:message-id:references:in-reply-to:content-type :mime-version; q=dns; s=default; b=bhHwWxD4BdXkHI+QDjgbTnVEA4lzH Rkr77GCJJw5I5hHQ24C9kIF6ADFC/iELfzSW+LuUCewHu8c4AixWMrTpZPKwluMz riLfRARTUzEQ1NYqVub5ccwQQzXma5iRI2VQak+143wL5s+Xwsf0v8CH7tgohMIz JNJwVcWrapHScc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :cc:subject:date:message-id:references:in-reply-to:content-type :mime-version; s=default; bh=X3o3zufCe9rj87JBXgdzmsu+rq0=; b=oRz fAgBBBYY9zChpq9ZRDkTbim5axUGz3Y0NJI3Et5L3NGV9Z949EVIq3mb1pVkq0Ly 5s6EjneFiuRvkwEMTCBJ1LEoyb41vHGEs8Q53LJ9fDgqDZnnBKa0e9PW+TZAN8He OIV9rAzBe3hafVGylXNjLUtPpD4Oc05ZOI/LmEA0= Received: (qmail 84681 invoked by alias); 20 Apr 2017 19:11:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 84223 invoked by uid 89); 20 Apr 2017 19:11:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, MISSING_HEADERS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:sk:HMHPRHH, H*c:HHH, *, x X-HELO: EUR03-DB5-obe.outbound.protection.outlook.com Received: from mail-oln040092071025.outbound.protection.outlook.com (HELO EUR03-DB5-obe.outbound.protection.outlook.com) (40.92.71.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Apr 2017 19:11:06 +0000 Received: from VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com (10.152.18.54) by VE1EUR03HT071.eop-EUR03.prod.protection.outlook.com (10.152.19.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1019.14; Thu, 20 Apr 2017 19:11:05 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com (10.152.18.54) by VE1EUR03FT047.mail.protection.outlook.com (10.152.19.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.14 via Frontend Transport; Thu, 20 Apr 2017 19:11:05 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com ([fe80::a806:64f0:6377:f3ea]) by AM4PR0701MB2162.eurprd07.prod.outlook.com ([fe80::a806:64f0:6377:f3ea%19]) with mapi id 15.01.1047.008; Thu, 20 Apr 2017 19:11:05 +0000 From: Bernd Edlinger CC: Yvan Roux , Bruce Korb , "gcc-patches@gcc.gnu.org" , Richard Biener , Jakub Jelinek , Jeff Law , Matthew Fortune Subject: [PATCH] Fix fixincludes for canadian cross builds - next try Date: Thu, 20 Apr 2017 19:11:04 +0000 Message-ID: References: <4b114aec-1ab7-7054-1086-a06d3b358a27@gnu.org> In-Reply-To: authentication-results: linaro.org; dkim=none (message not signed) header.d=none; linaro.org; dmarc=none action=none header.from=hotmail.de; x-incomingtopheadermarker: OriginalChecksum:81F2C3216F16AA5EC270F7786CE0EA44B002068C6DCC4B8BCA34F201F9CFAD43; UpperCasedChecksum:F84561BAFAE2702E69DF22EE61554F657954926B1771B5671DC5E45DB66813F2; SizeAsReceived:8906; Count:39 x-ms-exchange-messagesentrepresentingtype: 1 x-microsoft-exchange-diagnostics: 1; VE1EUR03HT071; 5:eGf3jraJoSZ/KhKzWNtw/yUszNMKL5SzlNpogJscPlReKmD5udg1QjzO4UuwAIEdHoaXwZ5DbZF0r6MAWxHQ258z3bW48RNQHrWfbWJqVL/ur1ZsDnNmNzSpgQHD9OFYkudf592PIN9wGd3/W+IdfQ==; 24:DGC7D55vp6UzvRfLx+0vR/i3EAMCNcImn3hp+tRGQRhZ9FMiiYnpL5mfPuG19lYX5uLunk2Ui14Kz+Tq5Yxe3zV3LGMy6GZrKhnLXyM5feA=; 7:0dTzSYH2R/TAzygh8knXfvSMkL0QcX0ROz30i8fviRr8HSXIe639yQTemKgORE3rLRfh+EYSbAnJUhzB2hzjqtx5Hg/gvefwAgviwIKe72dzxbHH30/Y5VL9z2eKm3voa3qka9e5ZO70sRmU5snZQB1hdUC2g//fzwBHOMAZJoPSHbty2gOPlwgW/vXD6tUt8cKgM7SnoR5kA6rSlWio3oAZpR8iC82QiD5cNEmhVxcRzvd921K/dyoL+ZxPnIMzRgtwO45WBCM4TXWX9HQBByaL47yNTJ8T8bopgdye1oqKqBPQGCY4mlLepH0qtx0o x-incomingheadercount: 39 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR03HT071; H:AM4PR0701MB2162.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: c52884da-c6f8-42df-64fa-08d48820fd74 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322274)(1603101448)(1601125374)(1701031045); SRVR:VE1EUR03HT071; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:VE1EUR03HT071; BCL:0; PCL:0; RULEID:; SRVR:VE1EUR03HT071; x-forefront-prvs: 02830F0362 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2017 19:11:04.9438 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR03HT071 Hi! This is my new attempt to clean up the different cross compiler configurations. It turned out to be a very complicated matter, so I thought it would be better to postpone it to the stage1. In a canadian cross compiler setup we have a different header dir path for use in the build and later on the target, which is written to install-tools/mkheaders.conf, so I propose to export SYSTEM_HEADER_DIR and BUILD_SYSTEM_HEADER_DIR from configure.ac to be used in Makefile.in. I also removed unnecessary handling of --with-headers, because the headers are copied to sys-include and thus it is not necessary to use the original path here. If --with-sysroot or --with-build-sysroot is used the SYSTEM_HEADER_DIR or BUILD_SYSTEM_HEADER_DIR contain $${sysroot_headers_suffix}, which is normally an empty string, but on mips it may be something like "mips-r2" which gets appended to the sysroot for use of fixincludes but "target_header_dir" which is used in configure to find things like the GLIBC version it is not used. I assume that that either does not create problems and is silently ignored, or that people have a work around, my patch should not change that, however I have not been able to setup a sysroot for mips*-img-linux* or mips*-mti-linux* which seem to be the only targets where this might make a difference. I have tested all different combinations of --with-sysroot / --with-build-sysroot. Even a native build with --with-sysroot works. Except go of course: cross-builds are a no-go area for the go language in general ;) As before I would appreciate your kind help with testing the many different build setups. So far I have tested native x86_64-pc-linux-gnu and arm-linux-gnueabihf cross build configurations. And everything looks sane. Is it OK for trunk? Thanks Bernd. 2017-04-18 Bernd Edlinger * configure.ac (SYSTEM_HEADER_DIR, BUILD_SYSTEM_HEADER_DIR, target_header_dir): Set correctly. * configure: Regenerated. * Makefile.in (BUILD_SYSTEM_HEADER_DIR): New make variabe. (LIMITS_H_TEST, if_multiarch, stmp-fixinc): Use BUILD_SYSTEM_HEADER_DIR instead of SYSTEM_HEADER_DIR. Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 246979) +++ gcc/configure.ac (working copy) @@ -1998,41 +1998,29 @@ done CROSS= AC_SUBST(CROSS) ALL=all.internal AC_SUBST(ALL) SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR) +BUILD_SYSTEM_HEADER_DIR=$SYSTEM_HEADER_DIR AC_SUBST(BUILD_SYSTEM_HEADER_DIR) -if test "x$with_build_sysroot" != x; then - build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' -else - # This value is used, even on a native system, because - # CROSS_SYSTEM_HEADER_DIR is just - # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR). - build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)' -fi +if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x || + test x$build != x$host || test "x$with_build_sysroot" != x; then + if test "x$with_build_sysroot" != x; then + BUILD_SYSTEM_HEADER_DIR=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' + else + BUILD_SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' + fi -if test x$host != x$target -then - CROSS="-DCROSS_DIRECTORY_STRUCTURE" - ALL=all.cross - SYSTEM_HEADER_DIR=$build_system_header_dir - case $target in - *-*-mingw*) - if test "x$with_headers" = x; then - with_headers=yes - fi - ;; - *) - ;; - esac -elif test "x$TARGET_SYSTEM_ROOT" != x; then - SYSTEM_HEADER_DIR=$build_system_header_dir -fi + if test x$host != x$target + then + CROSS="-DCROSS_DIRECTORY_STRUCTURE" + ALL=all.cross + SYSTEM_HEADER_DIR=$BUILD_SYSTEM_HEADER_DIR + elif test "x$TARGET_SYSTEM_ROOT" != x; then + SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' + fi -if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then - if test "x$with_headers" != x && test "x$with_headers" != xyes; then - target_header_dir=$with_headers + if test "x$with_build_sysroot" != "x"; then + target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = x; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" - elif test "x$with_build_sysroot" != "x"; then - target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = xyes; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else Index: gcc/configure =================================================================== --- gcc/configure (revision 246979) +++ gcc/configure (working copy) @@ -719,6 +719,7 @@ BUILD_CFLAGS CXX_FOR_BUILD CC_FOR_BUILD inhibit_libc +BUILD_SYSTEM_HEADER_DIR SYSTEM_HEADER_DIR ALL CROSS @@ -12214,41 +12215,29 @@ done CROSS= ALL=all.internal SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' +BUILD_SYSTEM_HEADER_DIR=$SYSTEM_HEADER_DIR -if test "x$with_build_sysroot" != x; then - build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' -else - # This value is used, even on a native system, because - # CROSS_SYSTEM_HEADER_DIR is just - # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR). - build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)' -fi +if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x || + test x$build != x$host || test "x$with_build_sysroot" != x; then + if test "x$with_build_sysroot" != x; then + BUILD_SYSTEM_HEADER_DIR=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' + else + BUILD_SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' + fi -if test x$host != x$target -then - CROSS="-DCROSS_DIRECTORY_STRUCTURE" - ALL=all.cross - SYSTEM_HEADER_DIR=$build_system_header_dir - case $target in - *-*-mingw*) - if test "x$with_headers" = x; then - with_headers=yes - fi - ;; - *) - ;; - esac -elif test "x$TARGET_SYSTEM_ROOT" != x; then - SYSTEM_HEADER_DIR=$build_system_header_dir -fi + if test x$host != x$target + then + CROSS="-DCROSS_DIRECTORY_STRUCTURE" + ALL=all.cross + SYSTEM_HEADER_DIR=$BUILD_SYSTEM_HEADER_DIR + elif test "x$TARGET_SYSTEM_ROOT" != x; then + SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' + fi -if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then - if test "x$with_headers" != x && test "x$with_headers" != xyes; then - target_header_dir=$with_headers + if test "x$with_build_sysroot" != "x"; then + target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = x; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" - elif test "x$with_build_sysroot" != "x"; then - target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = xyes; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else @@ -18433,7 +18422,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18436 "configure" +#line 18425 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18539,7 +18528,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18542 "configure" +#line 18531 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 246979) +++ gcc/Makefile.in (working copy) @@ -517,11 +517,14 @@ CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR # macro is also used in a double-quoted context. SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` +# Path to the system headers on the build machine. +BUILD_SYSTEM_HEADER_DIR = `echo @BUILD_SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` + # Control whether to run fixincludes. STMP_FIXINC = @STMP_FIXINC@ # Test to see whether exists in the system header files. -LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] +LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ] # Directory for prefix to system directories, for # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc. @@ -572,7 +575,7 @@ ifeq ($(enable_multiarch),yes) else ifeq ($(enable_multiarch),auto) # SYSTEM_HEADER_DIR is makefile syntax, cannot be evaluated in configure.ac - if_multiarch = $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1)) + if_multiarch = $(if $(wildcard $(shell echo $(BUILD_SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1)) else if_multiarch = endif @@ -2992,11 +2995,11 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \ sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \ multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \ fix_dir=include-fixed$${multi_dir}; \ - if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \ + if ! $(inhibit_libc) && test ! -d ${BUILD_SYSTEM_HEADER_DIR}; then \ echo The directory that should contain system headers does not exist: >&2 ; \ - echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ + echo " ${BUILD_SYSTEM_HEADER_DIR}" >&2 ; \ tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \ - if test "x${SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \ + if test "x${BUILD_SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \ then sleep 1; else exit 1; fi; \ fi; \ $(mkinstalldirs) $${fix_dir}; \ @@ -3007,7 +3010,7 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \ export TARGET_MACHINE srcdir SHELL MACRO_LIST && \ cd $(build_objdir)/fixincludes && \ $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \ - $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \ + $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \ rm -f $${fix_dir}/syslimits.h; \ if [ -f $${fix_dir}/limits.h ]; then \ mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \