Received: by 10.223.185.116 with SMTP id b49csp865563wrg; Wed, 21 Feb 2018 08:09:48 -0800 (PST) X-Google-Smtp-Source: AH8x225YF/Zd6TMOsufs4aVspoKvkft3JvjDZfLcs4jFl6Jb9OaUWeVvg4t8aGCVxAk5R5wRihUC X-Received: by 2002:a17:902:44:: with SMTP id 62-v6mr3507087pla.193.1519229388078; Wed, 21 Feb 2018 08:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519229388; cv=none; d=google.com; s=arc-20160816; b=Y5u0eTX2nqpTalxSGmpHDy7kqMTpNRTZ1oqaShKbBM61bbfnre/U/foiUe6x7vMDeY m4dY2HILEHiGmvR1KT/Z+qvqstPbwMUpNy2BIDrAvHsqicDy/YIPvEWTTSL5/KxQT1mq n379bFru4E2BB38mN2sFI9WAV4DR62sl8WYQTzYW6GyQ0dLHuGzMlAx1k3i/1oMbJ42E 7ZzEXyXtWX+tX1SDVc83HYMeAtWr0Dl1lrOu2inaqqNOHiNikJMf5AA4TieEBm+siM52 +zuHYBqDRQMV45aAR0/ctf3iKOIyCM6MTFnZ7X00BGvvR0jc82qpcA6YKT7cBNW9n59e z/6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=qIrQpj7b2XceRh8ELIcBf339Q97yZZkf4UpGHkVyJvM=; b=YqD6snm9FMU2R8HUxoi6I3Lw7KAWTl4Pi/13BuSwsYRNdPbRTjWGXfIUtIqtUDX2Lc 1KXUYGRNVSsAfFM6XX89gsZhXTz366sTzoQWS/Is/QsJvg+kV0yx9JJ6DGbeO++xc9Dg Kwa2DZHBlO5xTXu1LToXhO4JtYZRzDTpL4G7iQJPo6imUH8VJj/q8jnc4MNEQjOd3H6p MCp0LFkFfeVWvbr+m1BnlAioQbrishvDt5mBRp8AugROj0RVF1rOSPuhXeX2I8desuT+ 1TePyX3ceB6hGN7EPOnl90rz5x64dmynbsTzF9m3snnj0LgckS9tv9f/QCx+s/pqdFua zcKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VykHe53r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z124si1557955pgb.677.2018.02.21.08.09.33; Wed, 21 Feb 2018 08:09:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VykHe53r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932728AbeBUKJz (ORCPT + 99 others); Wed, 21 Feb 2018 05:09:55 -0500 Received: from mail-it0-f43.google.com ([209.85.214.43]:55062 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932631AbeBUKJy (ORCPT ); Wed, 21 Feb 2018 05:09:54 -0500 Received: by mail-it0-f43.google.com with SMTP id p204so1620888itc.4 for ; Wed, 21 Feb 2018 02:09:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qIrQpj7b2XceRh8ELIcBf339Q97yZZkf4UpGHkVyJvM=; b=VykHe53rOsLwpFnQNYyKyEj3FzW2r/h633f8Terk5YJ55H8DngYAgk13F8Z1+FHsTy 266IO0XXqWlqpdyw/QViwBP9AjnNkdPrlC8F5FVIBmdjUbDCFOJMOgoqN053R7XTRmnN +mQdCXKpwkXRveQ56QC9zWD22VI0F1a3Hrnu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qIrQpj7b2XceRh8ELIcBf339Q97yZZkf4UpGHkVyJvM=; b=WRzS1CcqDblJ2/1VkH+tiCw960KHY/C4jJuhmYZNCvmm9fK7oMqgpwRQtZ06TGW8xp V5sx0x+WUEMBTfdX+v7dEMVk6nL/7W013NZONNqzwBsffc3CEfiZsEppc10WVg10ev4P eOmYihr4KqQ7vUNaEHoGMvu5fofN7TBDyBweMfHAudm7eIA7ZDGO0dzWmUSkkhT1G550 RGHmyLwyzLjPx2AVCYLbUUqUrpuyoNwp8rjA65/AXdrYWdbIXkaHGpyhaxREKQPw86eX /Ad9l4pj4Yz0KDV+fQS+9ttdUgvznlCXrpG+vSLgbA1ynHJYh6YIrQoJnb/zQSrfup0F 0grg== X-Gm-Message-State: APf1xPD8lRqYD8RVm/tHDX8LlbPLUBSQVwOr5nHreEAhQAC5eSZnvNZD jGXvOYLOvsQw0sK6m6zZ3RyFyEHsBLMJZlWaRp6Bmg== X-Received: by 10.36.204.4 with SMTP id x4mr1102940itf.42.1519207793861; Wed, 21 Feb 2018 02:09:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Wed, 21 Feb 2018 02:09:53 -0800 (PST) In-Reply-To: References: <20180220215954.4092811-1-arnd@arndb.de> <20180220215954.4092811-4-arnd@arndb.de> From: Ard Biesheuvel Date: Wed, 21 Feb 2018 10:09:53 +0000 Message-ID: Subject: Re: [PATCH 3/7] [HACK] pass endianess flag to LTO linker To: Arnd Bergmann Cc: Nicolas Pitre , Andi Kleen , Linux Kernel Mailing List , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21 February 2018 at 09:48, Arnd Bergmann wrote: > On Wed, Feb 21, 2018 at 9:37 AM, Ard Biesheuvel > wrote: >> On 20 February 2018 at 21:59, Arnd Bergmann wrote: >>> We need some way to pass -mbig-endian to the linker during the >>> LTO link stage, otherwise we get a waning like >>> >>> arm-linux-gnueabi/bin/ld: arch/arm/lib/clearbit.o: compiled for a big endian system and target is little endian >>> >>> for each file we link in. >>> >>> There is probably a better method of passing that flag, I'm just >>> adding it to a different hack that I added earlier for x86 LTO >>> here. >>> >> >> In general, LTO requires that *all* C flags are passed to the linker. >> Given that linking now involves code generation, any C flag that >> affects code generation must be visible to the linker as well, which >> includes all the tweaks and overrides that we add per-file or >> per-directory. It is not clear to me how much of this is carried in >> the intermediate representation as metadata, but we should probably >> err on the side of caution here, and update the Kbuild routines to >> pass the complete value of KBUILD_CFLAGS (or whatever it is called) to >> ld as well. > > It looks like we're just missing KBUILD_CPPFLAGS. > > However, I wonder for the more general case what happens to files > that require non-standard CFLAGS. That was kind of my point, yes. > In some cases we turn off > some optimization step for a file, we might remove '-pg', or build for > a particular target architecture. Do we have to turn off -flto for any file > that requires this for correct behavior? > Excellent question. I think the problem is that the file boundary is becoming blurred with LTO, and so any option that is absolutely required to build a single file correctly may need to be applied to vmlinux as a whole. Whether that is the case for any particular option depends on which compiler pass(es) is (are) affected by the option, i.e., whether it is taken into account when creating the intermediate representation.