Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp17471imm; Thu, 12 Jul 2018 13:14:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdG3QJgquxzasVIZvt+WbsY9NIBPZbqdjs5WAx00eCEq2CZSfHjtLoyKLE12VwtKhnR4wpy X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr3523180pld.118.1531426492631; Thu, 12 Jul 2018 13:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531426492; cv=none; d=google.com; s=arc-20160816; b=ZrP1tnVt/h8nXvTppyMe9JEHssOYnjDlMgjIMcQd31iXn7C2hI2cGhiePnQ4ZayL+w LzKxDc/MnPy1TbqM8Ztmvij317OH4ghIzrQajRYQEcsKsF3JOc8aZFOC1bNGAcB1iV7q 1ZP2/gz/Wc3VfYArdgT7PolvN3EJ91a/tN9sadFb2uQ6jMYHWN2h+o/3JIYgg2VcFd4/ +MPWqyvVc9D6lYXYmDqXfDpIEEGzbkhjJfr2erGMQV7bjVHmQcagV3N9q+AALZx+qNWU NRwkpsHBpEWoPyVAw3lVzTeAt+WdVoAo+OhFr09/yrLsJwC63Zx1hpJ4hA6IZ4aoqaPF gFtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:message-id:date :mime-version:dkim-signature:arc-authentication-results; bh=7HBBS12wdzPnBqb4PrxQnvTynFROAsoBAJFMXIhIg7Q=; b=0HOZBFrarEEHnl5Ek1Z5I+MSrA9/8lGgPnzJW0ZDZgmIxWYPdMXnja/EM9zEyM9SrV cQGLCt4eVm0O4br/oU2XqMVjamFuZYnWgdLrFNtVjJ2KMQZCH8e+WJdRLYSvVXYwnmEZ BK9AAYs8GW2LZObAB6KKajpFhKvndoBh3rZ9UdH46pXWNPZsSjbz2Il84Hm4KM5eITgY dqQYEoi8GToevojLRb2zYBN5BheZ1Z1VosKfi70X5PAfWKXEoeNbR8JeBAol1zJ+kJ8F u9HlH+rhByJBypAskqRBjKz/ADMR/PV737Wp0w8s/0JU1vNBpB49KbvhGzL6KN4vpRLc H0TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=eXZ58IUy; 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 j190-v6si22777553pfb.211.2018.07.12.13.14.12; Thu, 12 Jul 2018 13:14:52 -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=eXZ58IUy; 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 S1732467AbeGLUVm (ORCPT + 99 others); Thu, 12 Jul 2018 16:21:42 -0400 Received: from mail-oi0-f73.google.com ([209.85.218.73]:46310 "EHLO mail-oi0-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbeGLUVm (ORCPT ); Thu, 12 Jul 2018 16:21:42 -0400 Received: by mail-oi0-f73.google.com with SMTP id j5-v6so41432204oiw.13 for ; Thu, 12 Jul 2018 13:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:message-id:subject:from:to:cc; bh=7HBBS12wdzPnBqb4PrxQnvTynFROAsoBAJFMXIhIg7Q=; b=eXZ58IUykEz8VdCuzNS6RPoVPfkmTF1iOoslHx1q2+xQRoF9blLLyNpSG+yd6pB6VB /GBnY1suP6yD//ftGZ5vEWpfLpg7M2WjS6EM97RCVI/MaWlKMmEqggoGcBA7r5g868F6 PmSysizzQ6f165LhH5B44C+DKgSiLLJw5g2mdOcY7exSUgZHhhrVKpgiyB5pbrYll8h3 VVt3LFOCTB7hK+i5ZADi36HBQbsYnyEoFct1XvToGCfii9KAnhzCd90NxWcCcleRZocW iWZkj23EnToiKpnIwV2NV4z+AAS7RT0XC9gd604gi/VMIBS/1sSvaQv2GOP+6fwOMEnE t6+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=7HBBS12wdzPnBqb4PrxQnvTynFROAsoBAJFMXIhIg7Q=; b=lMGjSgWMMZyj+EgY0nrxLXCd9Apt6uo3mmG8aaYDIaLa6umvDpTYD3hUIXpCYWRIR8 7RWozA2CbRTJnuIhpkH3D9P888BfMcsAerkEw1cRvUtEjf/e8BO3FfwSSAcpfyU89+/L jFVxV3LVrzfAVaPUM3/FSCguVDmWRlvNazWxCulJ7P/wCd254mEi3Aj/nM0DkiFa9O1B 87VZ/aAvuxIcMiSrcdBC5wCqd48JDmGDaXHeeDIGp/48SUyBLcq78sZpLHpLNL4UaBPX hAF2EJmq2cYk/MdwjHDj/xPIKy74obPp4rEr7hI4HBLvs5EXREF0eVnZc6uXjh6BgT3a X1lQ== X-Gm-Message-State: AOUpUlGR4ZPFPeDuUDhMmYAgOucE7pjAQoi1V55luqFe/1I/x0WWr1cm fIpr72g0JheywihSoxDd4/qB70cFw1eIwnHTEgSIDIQucFP0+OYuDgdKS6kDyTV2+bDbIgCN90x jZy6IZZgip+KvPz5nPoXnmZou6DPpxaSsWxA/YQABpppHLZ9/Z1stpBqBmGLE9HfhbUtX550dWI GaEA== MIME-Version: 1.0 X-Received: by 2002:aca:bd84:: with SMTP id n126-v6mr2235933oif.78.1531426235108; Thu, 12 Jul 2018 13:10:35 -0700 (PDT) Date: Thu, 12 Jul 2018 13:10:32 -0700 Message-Id: <20180712201032.156997-1-astrachan@google.com> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog Subject: [PATCH] x86: vdso: Fix leaky vdso link with CC=clang From: Alistair Strachan To: linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , 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 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. Most of the time this goes unnoticed because the host linker is new enough to work anyway, but this cannot be reliably assumed. Extract the needed --target and --gcc-toolchain flags added in the top level Makefile from KBUILD_CFLAGS. These flags direct clang to the appropriate toolchain to link the vdsos. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Greg Kroah-Hartman Cc: x86@kernel.org Cc: kernel-team@android.com Cc: joel@joelfernandes.com Signed-off-by: Alistair Strachan --- arch/x86/entry/vdso/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index 261802b1cc50..062ee94d2d26 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -163,7 +163,8 @@ quiet_cmd_vdso = VDSO $@ sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \ - $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS) + $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS) \ + $(filter --target=% --gcc-toolchain=%,$(KBUILD_CFLAGS)) GCOV_PROFILE := n #