From owner-svn-src-head@freebsd.org Tue Jun 13 00:31:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C20AAD877A2; Tue, 13 Jun 2017 00:31:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82743115D; Tue, 13 Jun 2017 00:31:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5D0VGuA078006; Tue, 13 Jun 2017 00:31:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5D0VGZ3078005; Tue, 13 Jun 2017 00:31:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201706130031.v5D0VGZ3078005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 13 Jun 2017 00:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319885 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jun 2017 00:31:17 -0000 Author: emaste Date: Tue Jun 13 00:31:16 2017 New Revision: 319885 URL: https://svnweb.freebsd.org/changeset/base/319885 Log: lld: ELF: Fix ICF crash on absolute symbol relocations. If two sections contained relocations to absolute symbols with the same value we would crash when trying to access their sections. Add a check that both symbols point to sections before accessing their sections, and treat absolute symbols as equal if their values are equal. Obtained from: LLD commit r292578 MFC after: 3 days Modified: head/contrib/llvm/tools/lld/ELF/ICF.cpp Modified: head/contrib/llvm/tools/lld/ELF/ICF.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/ICF.cpp Tue Jun 13 00:22:15 2017 (r319884) +++ head/contrib/llvm/tools/lld/ELF/ICF.cpp Tue Jun 13 00:31:16 2017 (r319885) @@ -245,7 +245,6 @@ bool ICF::variableEq(const InputSection *A if (&SA == &SB) return true; - // Or, the two sections must be in the same equivalence class. auto *DA = dyn_cast>(&SA); auto *DB = dyn_cast>(&SB); if (!DA || !DB) @@ -253,6 +252,11 @@ bool ICF::variableEq(const InputSection *A if (DA->Value != DB->Value) return false; + // Either both symbols must be absolute... + if (!DA->Section || !DB->Section) + return !DA->Section && !DB->Section; + + // Or the two sections must be in the same equivalence class. auto *X = dyn_cast>(DA->Section); auto *Y = dyn_cast>(DB->Section); if (!X || !Y)