From owner-svn-src-head@freebsd.org Thu Mar 29 13:55:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CA5EF78472; Thu, 29 Mar 2018 13:55:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F9616F48B; Thu, 29 Mar 2018 13:55:24 +0000 (UTC) (envelope-from dim@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 202781ABD4; Thu, 29 Mar 2018 13:55:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2TDtNh2009593; Thu, 29 Mar 2018 13:55:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2TDtNLh009590; Thu, 29 Mar 2018 13:55:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201803291355.w2TDtNLh009590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 29 Mar 2018 13:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331731 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 331731 X-SVN-Commit-Repository: base 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.25 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: Thu, 29 Mar 2018 13:55:24 -0000 Author: dim Date: Thu Mar 29 13:55:23 2018 New Revision: 331731 URL: https://svnweb.freebsd.org/changeset/base/331731 Log: Pull in r328738 from upstream lld trunk (by Rafael Espindola): Strip @VER suffices from the LTO output. This fixes pr36623. The problem is that we have to parse versions out of names before LTO so that LTO can use that information. When we get the LTO produced .o files, we replace the previous symbols with the LTO produced ones, but they still have @ in their names. We could just trim the name directly, but calling parseSymbolVersion to do it is simpler. This is a follow-up to r331366, since we discovered that lld could append version strings to symbols twice, when using Link Time Optimization. MFC after: 3 months X-MFC-With: r327952 Modified: head/contrib/llvm/tools/lld/ELF/InputFiles.cpp head/contrib/llvm/tools/lld/ELF/InputFiles.h head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Modified: head/contrib/llvm/tools/lld/ELF/InputFiles.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/InputFiles.cpp Thu Mar 29 12:52:58 2018 (r331730) +++ head/contrib/llvm/tools/lld/ELF/InputFiles.cpp Thu Mar 29 13:55:23 2018 (r331731) @@ -281,6 +281,10 @@ template ArrayRef ObjFile return makeArrayRef(this->Symbols).slice(1, this->FirstNonLocal - 1); } +template ArrayRef ObjFile::getGlobalSymbols() { + return makeArrayRef(this->Symbols).slice(this->FirstNonLocal); +} + template void ObjFile::parse(DenseSet &ComdatGroups) { // Read section and symbol tables. Modified: head/contrib/llvm/tools/lld/ELF/InputFiles.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/InputFiles.h Thu Mar 29 12:52:58 2018 (r331730) +++ head/contrib/llvm/tools/lld/ELF/InputFiles.h Thu Mar 29 13:55:23 2018 (r331731) @@ -167,6 +167,7 @@ template class ObjFile : public ELFFileBa static bool classof(const InputFile *F) { return F->kind() == Base::ObjKind; } ArrayRef getLocalSymbols(); + ArrayRef getGlobalSymbols(); ObjFile(MemoryBufferRef M, StringRef ArchiveName); void parse(llvm::DenseSet &ComdatGroups); Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Thu Mar 29 12:52:58 2018 (r331730) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Thu Mar 29 13:55:23 2018 (r331731) @@ -130,7 +130,10 @@ template void SymbolTable::addCombinedLTO for (InputFile *File : LTO->compile()) { DenseSet DummyGroups; - cast>(File)->parse(DummyGroups); + auto *Obj = cast>(File); + Obj->parse(DummyGroups); + for (Symbol *Sym : Obj->getGlobalSymbols()) + Sym->parseSymbolVersion(); ObjectFiles.push_back(File); } }