Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Apr 2019 17:23:48 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r498732 - in head/devel/llvm80: . files/lld
Message-ID:  <201904121723.x3CHNmCu080642@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Fri Apr 12 17:23:48 2019
New Revision: 498732
URL: https://svnweb.freebsd.org/changeset/ports/498732

Log:
  Apply a manually updated version of FreeBSD HEAD r338297 as required to
  build recent amd64 kernel.
  
  Reported by:	tijl
  Sponsored by:	DARPA, AFRL

Added:
  head/devel/llvm80/files/lld/patch-head-r338297.diff
     - copied, changed from r498478, head/devel/llvm70/files/lld/patch-head-r338297.diff
Modified:
  head/devel/llvm80/Makefile

Modified: head/devel/llvm80/Makefile
==============================================================================
--- head/devel/llvm80/Makefile	Fri Apr 12 17:11:38 2019	(r498731)
+++ head/devel/llvm80/Makefile	Fri Apr 12 17:23:48 2019	(r498732)
@@ -2,7 +2,7 @@
 
 PORTNAME=	llvm
 DISTVERSION=	8.0.0
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	devel lang
 MASTER_SITES=	http://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR}
 PKGNAMESUFFIX=	${LLVM_SUFFIX}

Copied and modified: head/devel/llvm80/files/lld/patch-head-r338297.diff (from r498478, head/devel/llvm70/files/lld/patch-head-r338297.diff)
==============================================================================
--- head/devel/llvm70/files/lld/patch-head-r338297.diff	Tue Apr  9 15:44:52 2019	(r498478, copy source)
+++ head/devel/llvm80/files/lld/patch-head-r338297.diff	Fri Apr 12 17:23:48 2019	(r498732)
@@ -18,34 +18,28 @@ Index: tools/lld/ELF/Config.h
    bool ZInitfirst;
    bool ZKeepTextSectionPrefix;
    bool ZNodelete;
-Index: tools/lld/ELF/Driver.cpp
-===================================================================
---- tools/lld/ELF/Driver.cpp	(revision 338296)
-+++ tools/lld/ELF/Driver.cpp	(revision 338297)
-@@ -338,7 +338,8 @@ static bool getZFlag(opt::InputArgList &Args, Stri
- 
- static bool isKnown(StringRef S) {
+--- tools/lld/ELF/Driver.cpp.orig	2019-02-14 10:49:15.000000000 +0000
++++ tools/lld/ELF/Driver.cpp	2019-04-09 17:24:01.029238000 +0100
+@@ -348,6 +348,7 @@ static bool getZFlag(opt::InputArgList &
+ static bool isKnownZFlag(StringRef S) {
    return S == "combreloc" || S == "copyreloc" || S == "defs" ||
--         S == "execstack" || S == "hazardplt" || S == "initfirst" ||
-+         S == "execstack" || S == "hazardplt" || S == "ifunc-noplt" ||
-+         S == "initfirst" ||
+          S == "execstack" || S == "global" || S == "hazardplt" ||
++	 S == "ifunc-noplt" ||
+          S == "initfirst" || S == "interpose" ||
           S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" ||
-          S == "nocombreloc" || S == "nocopyreloc" || S == "nodelete" ||
-          S == "nodlopen" || S == "noexecstack" ||
-@@ -843,6 +844,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &
-   Config->ZCopyreloc = getZFlag(Args, "copyreloc", "nocopyreloc", true);
+          S == "nocombreloc" || S == "nocopyreloc" || S == "nodefaultlib" ||
+@@ -871,6 +872,7 @@ void LinkerDriver::readConfigs(opt::Inpu
    Config->ZExecstack = getZFlag(Args, "execstack", "noexecstack", false);
+   Config->ZGlobal = hasZOption(Args, "global");
    Config->ZHazardplt = hasZOption(Args, "hazardplt");
 +  Config->ZIfuncnoplt = hasZOption(Args, "ifunc-noplt");
    Config->ZInitfirst = hasZOption(Args, "initfirst");
+   Config->ZInterpose = hasZOption(Args, "interpose");
    Config->ZKeepTextSectionPrefix = getZFlag(
-       Args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
-Index: tools/lld/ELF/Relocations.cpp
-===================================================================
---- tools/lld/ELF/Relocations.cpp	(revision 338296)
-+++ tools/lld/ELF/Relocations.cpp	(revision 338297)
-@@ -366,6 +366,10 @@ static bool isStaticLinkTimeConstant(RelExpr E, Re
-           R_TLSLD_HINT>(E))
+--- tools/lld/ELF/Relocations.cpp.orig	2019-01-17 13:47:57.000000000 +0000
++++ tools/lld/ELF/Relocations.cpp	2019-04-09 17:38:19.651286000 +0100
+@@ -381,6 +381,10 @@ static bool isStaticLinkTimeConstant(Rel
+                      R_TLSLD_HINT, R_TLSIE_HINT>(E))
      return true;
  
 +  // The computation involves output from the ifunc resolver.
@@ -54,38 +48,37 @@ Index: tools/lld/ELF/Relocations.cpp
 +
    // These never do, except if the entire file is position dependent or if
    // only the low bits are used.
-   if (E == R_GOT || E == R_PLT || E == R_TLSDESC)
-@@ -816,6 +820,10 @@ static void processRelocAux(InputSectionBase &Sec,
+   if (E == R_GOT || E == R_GOT_PLT || E == R_PLT || E == R_TLSDESC)
+@@ -844,6 +848,10 @@ static void processRelocAux(InputSection
      Sec.Relocations.push_back({Expr, Type, Offset, Addend, &Sym});
      return;
    }
 +  if (Sym.isGnuIFunc() && Config->ZIfuncnoplt) {
-+    InX::RelaDyn->addReloc(Type, &Sec, Offset, &Sym, Addend, R_ADDEND, Type);
++    In.RelaDyn->addReloc(Type, &Sec, Offset, &Sym, Addend, R_ADDEND, Type);
 +    return;
 +  }
    bool CanWrite = (Sec.Flags & SHF_WRITE) || !Config->ZText;
    if (CanWrite) {
      // R_GOT refers to a position in the got, even if the symbol is preemptible.
-@@ -985,7 +993,7 @@ static void scanReloc(InputSectionBase &Sec, Offse
+@@ -1012,7 +1020,7 @@ static void scanReloc(InputSectionBase &
    // all dynamic symbols that can be resolved within the executable will
    // actually be resolved that way at runtime, because the main exectuable
    // is always at the beginning of a search list. We can leverage that fact.
--  if (Sym.isGnuIFunc())
-+  if (Sym.isGnuIFunc() && !Config->ZIfuncnoplt)
-     Expr = toPlt(Expr);
-   else if (!Sym.IsPreemptible && Expr == R_GOT_PC && !isAbsoluteValue(Sym))
-     Expr = Target->adjustRelaxExpr(Type, RelocatedAddr, Expr);
-Index: tools/lld/ELF/Writer.cpp
-===================================================================
---- tools/lld/ELF/Writer.cpp	(revision 338296)
-+++ tools/lld/ELF/Writer.cpp	(revision 338297)
-@@ -1561,8 +1561,11 @@ template <class ELFT> void Writer<ELFT>::finalizeS
-   applySynthetic({InX::EhFrame},
-                  [](SyntheticSection *SS) { SS->finalizeContents(); });
+-  if (Sym.isGnuIFunc()) {
++  if (Sym.isGnuIFunc() && !Config->ZIfuncnoplt) {
+     if (!Config->ZText && Config->WarnIfuncTextrel) {
+       warn("using ifunc symbols when text relocations are allowed may produce "
+            "a binary that will segfault, if the object file is linked with "
+--- tools/lld/ELF/Writer.cpp.orig	2019-01-15 18:30:23.000000000 +0000
++++ tools/lld/ELF/Writer.cpp	2019-04-09 17:45:06.700098000 +0100
+@@ -1651,9 +1651,12 @@ template <class ELFT> void Writer<ELFT>:
+   // earlier.
+   finalizeSynthetic(In.EhFrame);
  
 -  for (Symbol *S : Symtab->getSymbols())
 +  for (Symbol *S : Symtab->getSymbols()) {
-     S->IsPreemptible |= computeIsPreemptible(*S);
+     if (!S->IsPreemptible)
+       S->IsPreemptible = computeIsPreemptible(*S);
 +    if (S->isGnuIFunc() && Config->ZIfuncnoplt)
 +      S->ExportDynamic = true;
 +  }



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