Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp858390ybv; Thu, 13 Feb 2020 10:49:02 -0800 (PST) X-Google-Smtp-Source: APXvYqz0Eq9XKLF9zfJahucPtp3fmBY+6yYfnq9DbdQsKqrx2PoCWA1nIzszcw7xwI/F3SnM9pCw X-Received: by 2002:aca:33d5:: with SMTP id z204mr3731780oiz.120.1581619742780; Thu, 13 Feb 2020 10:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581619742; cv=none; d=google.com; s=arc-20160816; b=dlKDkoUCCj7vFSctaVEMLlHJBWItWy7Nsewp8bagj7dyzlgUCTSIDxwurO2UYxSBRe E+6l+fCU/ijOLT99MXwoj3yInN7ZROA2TUi+n+wpUfwkwka2BBIBKjesUdKF9dtsXoAf Cmrfg4TaAnwA/FPfJaYNpIEeijxQZ2hSzWwKS7tNBhoWsa7EKpsQ0dtQpWGIbfcSBkk1 zKxqC5TGkF/oRpfznrjTBrOpyGrfqpNz2GV/OkpsI/SmAQbCjktFePU0vpLyFfPzC1rb YCvFt58odPlwWOYpeLUZCQqNJi5IkxcbINx5PcfCujrEA1kHV9i0Z32HAgEhKCoODw35 /yjw== 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:mime-version :message-id:date:dkim-signature; bh=q6Z9P/dVJ1hNdsghQK1UTCWedGdDNEtUHw2XO4diJH8=; b=Dil/GXCBHUKI/C3VLTZHCB8TbaWpLKuNx324ZyCGsIDjSePPXz1++NvPSnWrPuJT1K smOo6opzvYD8l/qjvlG7hzh9d4iO0iwYwW+PgHfT+nmA7JSehKqsL8PzGc/xtD23Pcku Gh+IKCKXUFMyRoBG5w0K8a5aCYFgyc1NHCvV5jyI4JfgnwVda9EDzbQ1O0rn33k4wF7T 6QWKEYPydczySvXja49uIE240smxxgYInWwfMBzVNAWZ3s+WMBktgIjzyUs1nuK8+LaH HT0wT9CfO4u2vjD8NsEPXzdECodwqG1ou3TmYOLdXIyZho2SccsQr5Ck1ZtbPbGs4Z9m 45Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=B8IzkPfi; 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 l15si1531387oic.220.2020.02.13.10.48.48; Thu, 13 Feb 2020 10:49:02 -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=@google.com header.s=20161025 header.b=B8IzkPfi; 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 S1727811AbgBMSrU (ORCPT + 99 others); Thu, 13 Feb 2020 13:47:20 -0500 Received: from mail-ua1-f73.google.com ([209.85.222.73]:48325 "EHLO mail-ua1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgBMSrT (ORCPT ); Thu, 13 Feb 2020 13:47:19 -0500 Received: by mail-ua1-f73.google.com with SMTP id m2so1668436ual.15 for ; Thu, 13 Feb 2020 10:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=q6Z9P/dVJ1hNdsghQK1UTCWedGdDNEtUHw2XO4diJH8=; b=B8IzkPfiDs+4w+hN3BIhtLvlwpZLtZJNNjh/Rg9ugfQPd1tZyGCdohhNoUR2HtbsqJ rKF2WKANlBkRxzLTMHru7xB5W8fecWqkIUkbopggT2Qvemsk4pfMtF62XMkZ2mIvw3g0 S+UVvsZVbUyv6lMPqLBm/fjlkTXCXEzjTusVgBqkTM7TxhDRZPex65oUq9AxTc+4mkzI RguoQ/7wOjudBSZ/H2LatAcRwufEeMkbOOJHBtrjLeAryg2FupFtiR/J/Yck/cSwpvVh LbIyHHrKZTBS464tKAjZ2V2ArIlyvaHnU/04XugcRcvRIEe/v5ONIoF9HyX2/kZS4Opu HNmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=q6Z9P/dVJ1hNdsghQK1UTCWedGdDNEtUHw2XO4diJH8=; b=WGjqCW80q2eiGmj2/DuOvsNQQHRXYRYk3S7az+RoQyRVil0vJ/35xPW7Jaa4V4B2J6 vku/eKkmr3okvso6TfBXlcAOKJCIv2bEkeGcUDdtAzJGnILi//B+bJ8fGtsqnp0o11Q5 Vn/TTh/jFkHs4c26WsfcI1Odf0oEymWiycUraz24lKfxcUhJ1aXCoWMFg6GwpSjAIZ1M CIQLPZkzAK7QcNgYf2ugNVUmswEFTEV/Amf3wH+rv3a9GRBUV62YIqMwXrbrRI3EgNCd I9uIovvQJl+ZduMgwViZxE5MGTrFdQXeDJNlpaubXzAiP4ghTlhWjM0vOfTfpiLpbL0Y ZbBQ== X-Gm-Message-State: APjAAAVs7lYVLmKzGnBgKh2Rok+a+R+Rgy7kbaJxz53kTpSZgRW/ZDqF X1ZL1ByImQSafoKOVgewuKPdLpiYp+3wH0J9k08= X-Received: by 2002:a67:f30d:: with SMTP id p13mr16077583vsf.112.1581619637977; Thu, 13 Feb 2020 10:47:17 -0800 (PST) Date: Thu, 13 Feb 2020 10:47:08 -0800 Message-Id: <20200213184708.205083-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.0.225.g125e21ebc7-goog Subject: [PATCH] objtool: ignore .L prefixed local symbols From: Nick Desaulniers To: jpoimboe@redhat.com, peterz@infradead.org Cc: clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Fangrui Song , linux-kernel@vger.kernel.org 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 Top of tree LLVM has optimizations related to -fno-semantic-interposition to avoid emitting PLT relocations for references to symbols located in the same translation unit, where it will emit "local symbol" references. Clang builds fall back on GNU as for assembling, currently. It appears a bug in GNU as introduced around 2.31 is keeping around local labels in the symbol table, despite the documentation saying: "Local symbols are defined and used within the assembler, but they are normally not saved in object files." When objtool searches for a symbol at a given offset, it's finding the incorrectly kept .L$local symbol that should have been discarded by the assembler. A patch for GNU as has been authored. For now, objtool should not treat local symbols as the expected symbol for a given offset when iterating the symbol table. commit 644592d32837 ("objtool: Fail the kernel build on fatal errors") exposed this issue. Link: https://github.com/ClangBuiltLinux/linux/issues/872 Link: https://sourceware.org/binutils/docs/as/Symbol-Names.html#Symbol-Names Link: https://sourceware.org/ml/binutils/2020-02/msg00243.html Link: https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/286292010 Debugged-by: Nathan Chancellor Debugged-by: Fangrui Song Suggested-by: Josh Poimboeuf Signed-off-by: Nick Desaulniers --- Build tested allyesconfig with ToT Clang and GCC 9.2.1. Boot tested defconfig with ToT Clang and GCC 9.2.1. tools/objtool/elf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index edba4745f25a..9c1e3cc928b0 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -63,7 +63,8 @@ struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset) list_for_each_entry(sym, &sec->symbol_list, list) if (sym->type != STT_SECTION && - sym->offset == offset) + sym->offset == offset && + strstr(sym->name, ".L") != sym->name) return sym; return NULL; -- 2.25.0.225.g125e21ebc7-goog