From patchwork Sun Apr 19 18:04:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 11497797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54D8381 for ; Sun, 19 Apr 2020 18:04:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F9B62075E for ; Sun, 19 Apr 2020 18:04:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SEzYahmb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726530AbgDSSE6 (ORCPT ); Sun, 19 Apr 2020 14:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726472AbgDSSE6 (ORCPT ); Sun, 19 Apr 2020 14:04:58 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3D5C061A0C; Sun, 19 Apr 2020 11:04:58 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id k9so6832302oia.8; Sun, 19 Apr 2020 11:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=noeMRyfCXiVNDac4SbXL/yZSIwLo263SYX8F156uBM8=; b=SEzYahmb0dEcma2OmED8egn4Vohg7pDmFIUee7ZQrIQlW02yaKOWbIxgcoC5KEMJ+S NF/fjMNabSgVJUdeashBcatocSrjL2AcZJ9J70uIHB8NMSgZruXdL0tPzyU/ViP99UEU 3pu+kGg0P+LKHM4QbWzx47aw+OUfp41ekptnWNIRmVbONkEwslKzGGxlK3CCMCeCZ2L9 Y1XVUxp0pyFQ2F57IBLVzPoEtItWRkro6vYGZ7oqEV2pg7vUkErrz3WquoDedp4/34T+ sL6aryysjx/Qau79gRfDG72wDkCznhSfAqd04ivixCFVFFB39WxjeoQ9BIQB2ay4Z3hn J+Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=noeMRyfCXiVNDac4SbXL/yZSIwLo263SYX8F156uBM8=; b=NYKkodjWbE0unKl98av/XmTLdz+u8EExveA/tYDZDjxoEjxgIAvBy5/5p3lLUb1qHQ uiLBdanEUplxoegxcBxburzH6XtzUlMNmO9p3poLVogLPbYfj5JX6iis4vHCJio7GB6s YRF8lghbTIqviXA5uVnQbTMFpUW35EBBr28KCVkq5tmil3+hwwCHHTzGRfwUQnrq7MZP vsu1416hHpdMGIkW3MRuWT/G2QNpE++b6UNhVLe90ORdtMBYcRoRayDI6LClHxM6taVD lqhyuXPkQugZtN4n9xEe02SrP4Z9e21lA78ikIbSAg40AWdAA5210z/Rc7GemGFeYC2T sXYA== X-Gm-Message-State: AGi0PuZJhR5zYFCCdfvijRUSuV8lIVBSOmByaajpZeTx9Cyx9+JQTNj5 uiVkdLjpZF2ulqV+sSsDd/g= X-Google-Smtp-Source: APiQypJoH846YLVMv5jnqLShzu94g8oRiMnmBIkHXgUf9p88SARJoNlwf94kkTV7gsmszLFNA0sZ4w== X-Received: by 2002:aca:d6c1:: with SMTP id n184mr8245343oig.126.1587319497584; Sun, 19 Apr 2020 11:04:57 -0700 (PDT) Received: from localhost.localdomain ([2604:1380:4111:8b00::3]) by smtp.gmail.com with ESMTPSA id t10sm3720075oou.38.2020.04.19.11.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 11:04:57 -0700 (PDT) From: Nathan Chancellor To: Thomas Bogendoerfer , Masahiro Yamada Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, Nick Desaulniers , Sami Tolvanen , Dmitry Golovin , Sedat Dilek , Nathan Chancellor Subject: [PATCH 1/2] kbuild: add CONFIG_LD_IS_LLD Date: Sun, 19 Apr 2020 11:04:44 -0700 Message-Id: <20200419180445.26722-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Sami Tolvanen Similarly to the CC_IS_CLANG config, add LD_IS_LLD to avoid GNU ld specific logic such as ld-version or ld-ifversion and gain the ability to select potential features that depend on the linker at configuration time such as LTO. Signed-off-by: Sami Tolvanen [nc: Reword commit message] Signed-off-by: Nathan Chancellor --- Sami, please scream if you are unhappy with how I worded this commit. init/Kconfig | 3 +++ 1 file changed, 3 insertions(+) base-commit: 50cc09c18985eacbbd666acfd7be2391394733f5 diff --git a/init/Kconfig b/init/Kconfig index 9e22ee8fbd75..c15ee42b8272 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -23,6 +23,9 @@ config LD_VERSION config CC_IS_CLANG def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) +config LD_IS_LLD + def_bool $(success,$(LD) -v | head -n 1 | grep -q LLD) + config CLANG_VERSION int default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) From patchwork Sun Apr 19 18:04:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 11497801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F7A3913 for ; Sun, 19 Apr 2020 18:05:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35D262075E for ; Sun, 19 Apr 2020 18:05:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="azl4wDkC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726472AbgDSSFD (ORCPT ); Sun, 19 Apr 2020 14:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726441AbgDSSFC (ORCPT ); Sun, 19 Apr 2020 14:05:02 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 041FDC061A0C; Sun, 19 Apr 2020 11:05:01 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id z25so2599260otq.13; Sun, 19 Apr 2020 11:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vR4OoJO7KozFHQiJz0C5ZTDf3DqjOZtDT398xwIxeeI=; b=azl4wDkCSMKJ74rVGH7e1BnRmpVBfcQ7l8xnoRK30SrYkmN+CZ6M80VBfoPVg9KZYT GXVcJXJDswjIsXDIsI5AbRwsfHlvAOF5y/yPJhWWpsv34rXVXgmh2sk6+qK+QH7wr//o /5dx81w4IWfLZP2q7JiEiKCpCDrpRwJDzPx3Z/9ge7u3t+/xfyDWFDobJAMZ/yKsRaDf zRnPvBL2IIOoaVK85go5mH+1yKK5ib/ay8dl2ULsQ7x6d6stm63Y9bHln9iBC+tEqK6K iI8w/wn96e2omY2gpTIOsshgpARiKwxuM9T8pZ28HU1FI2Kt+VNEPjdld61o93TjO0mu UGHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vR4OoJO7KozFHQiJz0C5ZTDf3DqjOZtDT398xwIxeeI=; b=OTnQlmte6mPeJDu2YGXwdzgmfjXgkCDAL5eTouIqNbV+hYRBI1hNzLM/Oy8g64wtUk N0mm9Lf1gW8oagaXcqHT8kh+Vrb4bI7Nh2Q7RV+/k4Z0dGqWLxYo/ZXJtxCH/op0KkHq /LJNN3h3vX3FxNxpdIwRojDHesNr4wSG0NSi6KO9HhsPGNjPopRQ5B8qnrLfEWoNDUYV 44iEGAQ4Qz1HgpzhFJejrvdqtzJ1EyLGNDWNh5eYBs5x1d/eJNCsfKU10lSBtCy6cel3 DTHcDwqbyTMUgqomOype2PE3zZ1AmO+53yrVmoi8KMzpM4MmybOOKGgvOoO7eRfHx6US WRcQ== X-Gm-Message-State: AGi0PuYsUW18hOQnRmfxsJaEf1Yg89R6tHpWEGSwjikovyEUnf9LTxHx 8JB83bXNXIxIVDu7wkjRW8M= X-Google-Smtp-Source: APiQypI0AU/HahbKPMUS1RsluleWWt9SOsw+UeMO8nWI4CcYjCtnEZeQtXTleysjo3v8fs3oxuuXVw== X-Received: by 2002:a9d:3c8:: with SMTP id f66mr6551784otf.368.1587319500354; Sun, 19 Apr 2020 11:05:00 -0700 (PDT) Received: from localhost.localdomain ([2604:1380:4111:8b00::3]) by smtp.gmail.com with ESMTPSA id t10sm3720075oou.38.2020.04.19.11.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 11:05:00 -0700 (PDT) From: Nathan Chancellor To: Thomas Bogendoerfer , Masahiro Yamada Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, Nick Desaulniers , Sami Tolvanen , Dmitry Golovin , Sedat Dilek , Nathan Chancellor Subject: [PATCH 2/2] MIPS: VDSO: Do not disable VDSO when linking with ld.lld Date: Sun, 19 Apr 2020 11:04:45 -0700 Message-Id: <20200419180445.26722-2-natechancellor@gmail.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200419180445.26722-1-natechancellor@gmail.com> References: <20200419180445.26722-1-natechancellor@gmail.com> MIME-Version: 1.0 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Currently, when linking with ld.lld, this warning pops up: arch/mips/vdso/Makefile:70: MIPS VDSO requires binutils >= 2.25 ld-ifversion calls ld-version, which calls scripts/ld-version.sh, which is specific to GNU ld. ld.lld has a completely different versioning scheme (as it follows LLVM's versioning) and it does not have the issue mentioned in the comment above this block so it should not be subjected to this check. With this patch, the VDSO successfully links and shows P_MIPS_PC32 in vgettimeofday.o. $ llvm-objdump -Dr arch/mips/vdso/vgettimeofday.o | grep R_MIPS_PC32 00000024: R_MIPS_PC32 _start 000000b0: R_MIPS_PC32 _start 000002bc: R_MIPS_PC32 _start 0000036c: R_MIPS_PC32 _start 00000468: R_MIPS_PC32 _start Link: https://github.com/ClangBuiltLinux/linux/issues/785 Link: https://github.com/llvm/llvm-project/commit/e364e2e9ce50c12eb2bf093560e1a1a8544d455a Reported-by: Dmitry Golovin Signed-off-by: Nathan Chancellor --- arch/mips/vdso/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile index d7fe8408603e..f99e583d14a1 100644 --- a/arch/mips/vdso/Makefile +++ b/arch/mips/vdso/Makefile @@ -65,9 +65,11 @@ DISABLE_VDSO := n # the comments on that file. # ifndef CONFIG_CPU_MIPSR6 - ifeq ($(call ld-ifversion, -lt, 225000000, y),y) - $(warning MIPS VDSO requires binutils >= 2.25) - DISABLE_VDSO := y + ifndef CONFIG_LD_IS_LLD + ifeq ($(call ld-ifversion, -lt, 225000000, y),y) + $(warning MIPS VDSO requires binutils >= 2.25) + DISABLE_VDSO := y + endif endif endif