From patchwork Mon Feb 6 18:44:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 724645 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 3vHGbr5zRQz9ryb for ; Tue, 7 Feb 2017 05:44:39 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="H/TJ/l4S"; 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 :to:subject:date:message-id:content-type:mime-version; q=dns; s= default; b=BdVE+VHr5fCgO/p2S7k3k3uPKCD1HrscQvkXqazMUKOQkG4tUZuR5 6QxKk6HjkDPhdX0ZHwJ6u9MoOPp/CnKDB5WHrEhK+lQ3wzVyo5FGk//PsBKvB9FG EzolAAhq+ohnj6smZ9+6fx7pIwvpTA/VHzQM8NuI0EajbQhNmO6xbs= 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 :to:subject:date:message-id:content-type:mime-version; s= default; bh=12NlB4wR6Qns0z/UNtlAc7kj96Y=; b=H/TJ/l4S9RAIWUmRqbHx QanQPao9iP5f6nrqrVtOLyJigfz3prlVCyrO0nwRYty7Okx8kRIH3MWHePv+oe9R HDE78K0fVHZ9yb88yml3RMxXv2qNXeAvIHHVlcQr8xsEhg6jYnBbvpLYp/pk0BWD +DKPbsvCOankCzPK31xZFE0= Received: (qmail 51320 invoked by alias); 6 Feb 2017 18:44:28 -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 51284 invoked by uid 89); 6 Feb 2017 18:44:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=51718, Hx-spam-relays-external:sk:blu004-, HX-HELO:sk:BLU004-, H*RU:sk:blu004- X-HELO: BLU004-OMC2S32.hotmail.com Received: from blu004-omc2s32.hotmail.com (HELO BLU004-OMC2S32.hotmail.com) (65.55.111.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Feb 2017 18:44:15 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com ([65.55.111.73]) by BLU004-OMC2S32.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Mon, 6 Feb 2017 10:44:14 -0800 Received: from AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com (10.152.16.58) by AM5EUR03HT095.eop-EUR03.prod.protection.outlook.com (10.152.17.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.2; Mon, 6 Feb 2017 18:44:04 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com (10.152.16.54) by AM5EUR03FT024.mail.protection.outlook.com (10.152.16.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.7 via Frontend Transport; Mon, 6 Feb 2017 18:44:04 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com ([10.167.132.147]) by AM4PR0701MB2162.eurprd07.prod.outlook.com ([10.167.132.147]) with mapi id 15.01.0888.025; Mon, 6 Feb 2017 18:44:04 +0000 From: Bernd Edlinger To: "gcc-patches@gcc.gnu.org" , Bruce Korb , Richard Biener Subject: [PATCH] Fix fixincludes for canadian cross builds Date: Mon, 6 Feb 2017 18:44:03 +0000 Message-ID: authentication-results: gcc.gnu.org; dkim=none (message not signed) header.d=none; gcc.gnu.org; dmarc=none action=none header.from=hotmail.de; x-incomingtopheadermarker: OriginalChecksum:91D662293B9DEEFA4DD32C91DE7CDA40D59E50179FBC223A40FA119B7D4A9F34; UpperCasedChecksum:FA7137C4A64A669D306FE2F3967A50711AEA9FDE6BF3DCD3CF827F605D54A017; SizeAsReceived:7563; Count:34 x-ms-exchange-messagesentrepresentingtype: 1 x-incomingheadercount: 34 x-eopattributedmessage: 0 x-microsoft-exchange-diagnostics: 1; AM5EUR03HT095; 7:MFrtfE5Ns0GMp7dyhHNfc1RwMjXGHLc1e42+SgvC+dpOqkDiJBncXWTRtn+p8cFPQl/h25iWsyY/wziZEwl8/C2OlCmu+1bOHmgEu0uJaJkYafy3kpLhOMWOr0YkJoboogUfW6tneTGuU07sRUl/PEfCi4F2MqUw1po6Ya1z5yoieygbkvnIpeFs0ER9GUeceZo+xubiFgPcn7Hj59mXky77EuR0XQDUYxPdvqLMSNyzmkHKm5O50DfndyqwFJJYttufQ3dyXiUgAmoE7q4UWSCQ61Is5WxWUkTpFCagXFqjNnm/SWQ56JbytCr1QGbxGajRbnKo0aIAMKmnre66QS7UTmF60P/9gInJkOYJT2kJgIOlVsCdoHe8uFboaGdQlnxCsTEDHQkx5Qi3tD5+Dd3JK2n1e4PzKIbAqGF98FG+oWPHXkZVjV82tJMY5eo4WQTArQ8UoSfGSDMS8nr2UwAI/uZ+AzNB/uFOWpfGKaOcy6LfBK0o/f6nqzkaZXoXchgMULLr8I/GlfZF2F3l5A== x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900005); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5EUR03HT095; H:AM4PR0701MB2162.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: e8507a4f-9f08-4962-6803-08d44ec01f32 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(5061506426)(5061507331)(1603103135)(1601125107)(1701031045); SRVR:AM5EUR03HT095; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444111334)(432015086)(102415395)(82015046); SRVR:AM5EUR03HT095; BCL:0; PCL:0; RULEID:; SRVR:AM5EUR03HT095; x-forefront-prvs: 0210479ED8 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2017 18:44:03.9715 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR03HT095 Hi, I noticed that there is a subtle problem with build!=host configurations. That is, the fixinclude machinery is using the path that would work on the target system to find the headers that need to be fixed, but the build machine can have different header files than the target machine, even if th are at the same location. This can theoretically cause a mis-compilation of the target libraries. However the mkheaders script works on the target, and would fix it up, but the target libraries are not rebuilt, and they may have used the wrong fixed headers. To fix this inconsistency I would like to introduce a new make variable BUILD_SYSTEM_HEADER_DIR that is identical to SYSTEM_HEADER_DIR if build==host and which is CROSS_SYSTEM_HEADER_DIR for canadian cross configs. Only mkheaders.conf uses SYSTEM_HEADER_DIR because it runs on the host system, all other places should use BUILD_SYSTEM_HEADER_DIR. I tested this change with different arm-linux-gnueabihf cross compilers, and verified that mkheaders still works on the host system. Bootstrapped and reg-tested on x86_64-pc-linux-gnu. Is it OK for trunk? Thanks Bernd. 2017-02-06 Bernd Edlinger * 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/Makefile.in =================================================================== --- gcc/Makefile.in (revision 245184) +++ gcc/Makefile.in (working copy) @@ -517,11 +517,18 @@ # 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 +ifeq ($(build),$(host)) +BUILD_SYSTEM_HEADER_DIR = $(SYSTEM_HEADER_DIR) +else +BUILD_SYSTEM_HEADER_DIR = `echo $(CROSS_SYSTEM_HEADER_DIR) | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` +endif + # 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 +579,7 @@ 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 @@ -2990,11 +2997,11 @@ 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}; \ @@ -3005,7 +3012,7 @@ 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; \