Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp36220imm; Thu, 12 Jul 2018 13:38:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpevSCuAekEm18BQjoNECokLDsttgyb0Pgx/YTYorhb6ryVF386eeSP0wq+Ieo5HQ4rO8/6h X-Received: by 2002:a63:b40e:: with SMTP id s14-v6mr3473090pgf.9.1531427935366; Thu, 12 Jul 2018 13:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531427935; cv=none; d=google.com; s=arc-20160816; b=uTjqRPDSci6SkysJmGadj8813oW6CCpc7aruIWF09q3oO9VV3IPT0aJYIfMZ51qMNH O3Jz9REBwLoAR7Bvme3QY7ybYUmJbVMhltxO3kCQ96z0TMG6D+jUK3qKWxIJwE0MTiBK 1zXBB45OkSYj3BBQZb7W+9TZ26rnvD+Y3xDfXOjSTe2bO3Cqio7DINQtyquhngpAl8Eb 5Am2j3BnToQ4Vu8s5ReZ1Br0T/GUkN5MdUqcHCH57XW99o4lRLfW1mmE5zYWRmn3U6Fd h2lAHVxChjOvVJFvmugp/zu/RsO29OcBSzkrUg1mi3cAeZvxxCaYOrBi6BRaZA1TahO/ 22Ww== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=/CncoAKal/6ecb8G/QRbiv3nTxWWczK5WM/zDDkstCk=; b=ktZnO+2JCBelk6tpX1DdkOAaUWvtcg3FHwjZXECtKGB3uCd/0i7jC1Zs4zhZQx1Stg Xf3TQPmerGA/a53OS653HvmDD5Nfx1hlqWbqxDdpU3pM1+PD9BZlvdnIP2MDMNh1zfwc Vy/P1cmkIP0Unne6glRL1O5b5sALFyYxk5nUfF61I6JxuWeVSnH31vfBb8x3gtR40uzn ECRgp3PaQQEYPG6va65GVgD7E9i/JINNCQWxzZTe8/0vgexPFO9+mE8K5jXy9Y7+SsZ6 SQaKTgLiLNwQrmm9V6b1HPbQTw6LFywuNvwlwRAs4p1fQMlh15QwZyYf2gK841ZxrGtK dHQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BjfpOkpG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f90-v6si24110611pfe.291.2018.07.12.13.38.38; Thu, 12 Jul 2018 13:38:55 -0700 (PDT) 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=@google.com header.s=20161025 header.b=BjfpOkpG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732562AbeGLUtQ (ORCPT + 99 others); Thu, 12 Jul 2018 16:49:16 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:37952 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbeGLUtQ (ORCPT ); Thu, 12 Jul 2018 16:49:16 -0400 Received: by mail-io0-f195.google.com with SMTP id v26-v6so29415011iog.5 for ; Thu, 12 Jul 2018 13:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/CncoAKal/6ecb8G/QRbiv3nTxWWczK5WM/zDDkstCk=; b=BjfpOkpGR8yMEvRgz3KY08LDYTP1nVAtOk9BRY8tMTpO40U2Vvu/enWdL9fF4jn+nw kfLlBTJSDse3qoJb5k9uN3QAMI57PS6F8N/yevmEfrNf9hC296hWDM9vgmREut1Ti2j7 HoAwhb4cYS6zlVKUzvlv4RAOXjb99zaCLlXQbOrLYPhL4e4ftWkihu8HboU68rDiEffZ +mk8TIxu6C2TKYbeZprzI4IpZay1rdfEDTuiip0twi0iIYL/EyZQXxm6QePgfucHo37p qD4sOyFdQtAHISvZ7w7UVbKcdwI5ucLQ+SmKJxQZBYzfMI9bvV5E6r9VFN4s5upBDa+P iKGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/CncoAKal/6ecb8G/QRbiv3nTxWWczK5WM/zDDkstCk=; b=eR7j07jw5/5wBOeevXiqshGEmIvtTqAZ8MdPOwMabUT66S5srnzmrITatypdOdh6/y 7to9PIsF5Fi0mSezNXmo2LgOaGi2DzMH2cpebHBm3z9fAkQ2T0jpnOaADwDWrmb280Bv uoryVlnfVwjdfC51VMpaAI7zi3BI7bDnbd0Mc6yN047vXpBvEkz2lvhvKb1GZ3b2NVLT tvWqWTLU3wmcWFRURK1mj8vNmGpyfvZDE8MEbXaoiUu/oHkVQUbkfNxWSnLIaPNDlV4u xdQKtgmmbqOvBhDb5RMSWDBRy7PooTV78N1WT0+YmBCfCWarKISlsnS9U2TZhYJYpVu4 dogQ== X-Gm-Message-State: APt69E0kfatrUN27UBnq4CxQuxsz2+1qx/C7EmgOvM+8aK2mDI3zVsu9 MAUpN1SncAqchjI+hwAxlcsAg8MJ3Rm+q71dUt4FGMPV X-Received: by 2002:a6b:ac03:: with SMTP id v3-v6mr29090699ioe.71.1531427883244; Thu, 12 Jul 2018 13:38:03 -0700 (PDT) MIME-Version: 1.0 References: <20180712201032.156997-1-astrachan@google.com> <47d4b24e-8c60-fb3b-3377-62d20c5f3dd1@zytor.com> In-Reply-To: <47d4b24e-8c60-fb3b-3377-62d20c5f3dd1@zytor.com> From: Alistair Strachan Date: Thu, 12 Jul 2018 13:37:52 -0700 Message-ID: Subject: Re: [PATCH] x86: vdso: Fix leaky vdso link with CC=clang To: hpa@zytor.com Cc: linux-kernel@vger.kernel.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, Greg Kroah-Hartman , x86@kernel.org, kernel-team@android.com, joel@joelfernandes.com 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 Thu, Jul 12, 2018 at 1:25 PM H. Peter Anvin wrote: > On 07/12/18 13:10, Alistair Strachan wrote: > > The vdso{32,64}.so can fail to link with CC=clang when clang tries to > > find a suitable GCC toolchain to link these libraries with. > > > > /usr/bin/ld: arch/x86/entry/vdso/vclock_gettime.o: > > access beyond end of merged section (782) > > > > This happens because the host environment leaked into the cross > > compiler environment due to the way clang searches for suitable GCC > > toolchains. > > > > Is this another clang bug that you want a workaround for in the kernel? Clang is a retargetable compiler (specified with --target=) and so it has a mechanism for searching for suitable binutils (from another "GCC toolchain") to perform assembly and linkage. This mechanism relies on both --target and --gcc-toolchain when cross-compiling, otherwise it will fall back to searching /usr. The --target and --gcc-toolchain flags are already specified correctly in the top level Makefile, but the vdso Makefile rolls its own linker flags and doesn't use KBUILD_CFLAGS. Therefore, these flags get incorrectly dropped from the vdso $CC link command line, and an inconsistency is created between the "GCC toolchain" used to generate the objects for the vdso, and the linker used to link them.