Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Oct 2018 13:19:17 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339304 - in head: contrib/llvm/tools/lld/ELF lib/clang/include/lld/Common
Message-ID:  <201810111319.w9BDJH3Q080250@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu Oct 11 13:19:17 2018
New Revision: 339304
URL: https://svnweb.freebsd.org/changeset/base/339304

Log:
  lld: set sh_link and sh_info for .rela.plt sections
  
  ELF spec says that for SHT_REL and SHT_RELA sh_link should reference the
  associated string table and sh_info should reference the "section to
  which the relocation applies."  ELF Tool Chain's elfcopy / strip use
  this (in part) to control whether or not the relocation entry is copied
  to the output.
  
  LLVM PR 37538 https://bugs.llvm.org/show_bug.cgi?id=37538
  
  Approved by:	re (kib)
  Obtained from:	llvm r344226 (backported for 6.0)

Modified:
  head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
  head/lib/clang/include/lld/Common/Version.inc

Modified: head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp	Thu Oct 11 08:14:31 2018	(r339303)
+++ head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp	Thu Oct 11 13:19:17 2018	(r339304)
@@ -1213,11 +1213,13 @@ void RelocationBaseSection::addReloc(const DynamicRelo
 void RelocationBaseSection::finalizeContents() {
   // If all relocations are R_*_RELATIVE they don't refer to any
   // dynamic symbol and we don't need a dynamic symbol table. If that
-  // is the case, just use 0 as the link.
-  Link = InX::DynSymTab ? InX::DynSymTab->getParent()->SectionIndex : 0;
+  // is the case, just use the index of the regular symbol table section.
+  getParent()->Link = InX::DynSymTab ?
+    InX::DynSymTab->getParent()->SectionIndex :
+    InX::SymTab->getParent()->SectionIndex;
 
-  // Set required output section properties.
-  getParent()->Link = Link;
+  if (InX::RelaIplt == this || InX::RelaPlt == this)
+    getParent()->Info = InX::GotPlt->getParent()->SectionIndex;
 }
 
 template <class ELFT>

Modified: head/lib/clang/include/lld/Common/Version.inc
==============================================================================
--- head/lib/clang/include/lld/Common/Version.inc	Thu Oct 11 08:14:31 2018	(r339303)
+++ head/lib/clang/include/lld/Common/Version.inc	Thu Oct 11 13:19:17 2018	(r339304)
@@ -7,4 +7,4 @@
 
 #define LLD_REPOSITORY_STRING "FreeBSD"
 // <Upstream revision at import>-<Local identifier in __FreeBSD_version style>
-#define LLD_REVISION_STRING "335540-1200004"
+#define LLD_REVISION_STRING "335540-1200005"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810111319.w9BDJH3Q080250>