Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp105056imm; Thu, 12 Jul 2018 15:08:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeUkeyQ2UoyfmZ9rL/cfr0FscCb/qRTl+p3mPxbq+7lccQqcutTP2zGScozAinXtslVCGB1 X-Received: by 2002:a62:4695:: with SMTP id o21-v6mr4189474pfi.176.1531433290168; Thu, 12 Jul 2018 15:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531433290; cv=none; d=google.com; s=arc-20160816; b=MSIFUQ2IseYJMWgZRrazFvq0MPGlmgrBHMLccXtkry+385l4v2xNGsDaHnvwt1kfH/ T57JqAZKxlMEjdrcAte9LpiIukZxi99kNEKJuL1F+6kAgqEnBoUvqLZPSAMgtP2Q+MPL yMbHkN4YNmhIxdLbzq2s1f36TIlxgdyi7pRErQBUmfkYYAqIjRLAqklUMeX4uAaYlfY1 BZyBuhB8NpNhBgrB6IhO7RFSTJ2U2UDPWs/Q3ETbQpXAEE9kKeIYMWMhQKDjDJPB4izz S5G0W+AILFoW2uCYOj103S10pcgy5eFlCuqvHz8V5x4fWZjgGG5ANFZENJaGGkGvdLjF qXEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=m9WwEd6I97LFOrRskBlH15denifpU/w8PhKxUXnwskg=; b=BW+/k6bMMWRIyjNfSbhz5yQ/ldhwYfV8SHuh4qRhCF4JqQjp22afBE22T5MhZNLBgI Dtb+tvTo0lebvM77m6kej96sgjDiHgrSTmEtUPs+M2iHFG/jM160xoEl4BSAXpwXYn2z NZqJERT/f0BXD2BKPBopMnA9PC9gUeAlDcdhCpznzxydl8VL5c/5P3W+dm7tXEaXX/P4 nugANU5E3rlE/ZLeQNiJaGdintXEFDJ7MhZldSj5w9mo/pEe6vGlIo1gsJARiIXCQd7k is3Xkwby56l+5J/OWcz4g4jtLctLqKPl3u6qPP+M7IWxbV1xIYVPX7bKtCpCq9LZ4YxK neBA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23-v6si21987530pgl.275.2018.07.12.15.07.54; Thu, 12 Jul 2018 15:08:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732487AbeGLWSo (ORCPT + 99 others); Thu, 12 Jul 2018 18:18:44 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48705 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbeGLWSo (ORCPT ); Thu, 12 Jul 2018 18:18:44 -0400 Received: from carbon-x1.hos.anvin.org (c-24-5-245-234.hsd1.ca.comcast.net [24.5.245.234] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w6CM6x7v4066665 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 12 Jul 2018 15:06:59 -0700 Subject: Re: [PATCH] x86: vdso: Fix leaky vdso link with CC=clang To: Alistair Strachan 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 References: <20180712201032.156997-1-astrachan@google.com> <47d4b24e-8c60-fb3b-3377-62d20c5f3dd1@zytor.com> From: "H. Peter Anvin" Message-ID: <1432bfde-41b4-e8aa-037b-fca41a149cb8@zytor.com> Date: Thu, 12 Jul 2018 15:06:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12/18 13:37, Alistair Strachan wrote: > 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. > It sounds like there needs to be a more fundamental symbol than KBUILD_CFLAGS to contain these kinds of things. -hpa