pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/lld/patches lld: remove unused patches



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a091ddeb0ff1
branches:  trunk
changeset: 402997:a091ddeb0ff1
user:      adam <adam%pkgsrc.org@localhost>
date:      Sat Oct 19 14:02:36 2019 +0000

description:
lld: remove unused patches

diffstat:

 devel/lld/patches/patch-ELF_Driver.cpp      |  191 ----------------------------
 devel/lld/patches/patch-ELF_Driver.h        |   20 --
 devel/lld/patches/patch-ELF_Options.td      |   16 --
 devel/lld/patches/patch-ELF_Writer.cpp      |   35 -----
 devel/lld/patches/patch-docs_ld.lld.1       |   18 --
 devel/lld/patches/patch-test_ELF_gnustack.s |   25 ---
 6 files changed, 0 insertions(+), 305 deletions(-)

diffs (truncated from 329 to 300 lines):

diff -r 23e462103715 -r a091ddeb0ff1 devel/lld/patches/patch-ELF_Driver.cpp
--- a/devel/lld/patches/patch-ELF_Driver.cpp    Sat Oct 19 14:01:36 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-$NetBSD: patch-ELF_Driver.cpp,v 1.3 2019/09/08 20:49:11 rjs Exp $
-
-Add support for customizing LLD behavior on target triple.
-https://reviews.llvm.org/D56650
-
-Add '-z nognustack' option to disable emitting PT_GNU_STACK.
-https://reviews.llvm.org/D56554
-
-Alter defaults for NetBSD targets:
-* add default library search paths
-* force combined RO+RW segment due to ld.elf_so limitations
-* disable PT_GNU_STACK (meaningless on NetBSD)
-* disable 'new dtags', i.e. force RPATH instead of RUNPATH
-
---- ELF/Driver.cpp.orig        2019-02-14 10:49:15.000000000 +0000
-+++ ELF/Driver.cpp
-@@ -54,6 +54,7 @@
- #include "llvm/Support/LEB128.h"
- #include "llvm/Support/Path.h"
- #include "llvm/Support/TarWriter.h"
-+#include "llvm/Support/TargetRegistry.h"
- #include "llvm/Support/TargetSelect.h"
- #include "llvm/Support/raw_ostream.h"
- #include <cstdlib>
-@@ -318,6 +319,9 @@ static void checkOptions() {
- 
-     if (Config->SingleRoRx && !Script->HasSectionsCommand)
-       error("-execute-only and -no-rosegment cannot be used together");
-+  } else if (Config->TargetTriple.isOSNetBSD()) {
-+    // force-disable RO segment on NetBSD due to ld.elf_so limitations
-+    Config->SingleRoRx = true;
-   }
- }
- 
-@@ -352,6 +356,7 @@ static bool isKnownZFlag(StringRef S) {
-          S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" ||
-          S == "nocombreloc" || S == "nocopyreloc" || S == "nodefaultlib" ||
-          S == "nodelete" || S == "nodlopen" || S == "noexecstack" ||
-+         S == "nognustack" ||
-          S == "nokeep-text-section-prefix" || S == "norelro" || S == "notext" ||
-          S == "now" || S == "origin" || S == "relro" || S == "retpolineplt" ||
-          S == "rodynamic" || S == "text" || S == "wxneeded" ||
-@@ -365,6 +370,56 @@ static void checkZOptions(opt::InputArgL
-       error("unknown -z value: " + StringRef(Arg->getValue()));
- }
- 
-+void LinkerDriver::appendDefaultSearchPaths() {
-+  if (Config->TargetTriple.isOSNetBSD()) {
-+    // NetBSD driver relies on the linker knowing the default search paths.
-+    // Please keep this in sync with clang/lib/Driver/ToolChains/NetBSD.cpp
-+    // (NetBSD::NetBSD constructor)
-+    switch (Config->TargetTriple.getArch()) {
-+    case llvm::Triple::x86:
-+      Config->SearchPaths.push_back("=/usr/lib/i386");
-+      break;
-+    case llvm::Triple::arm:
-+    case llvm::Triple::armeb:
-+    case llvm::Triple::thumb:
-+    case llvm::Triple::thumbeb:
-+      switch (Config->TargetTriple.getEnvironment()) {
-+      case llvm::Triple::EABI:
-+      case llvm::Triple::GNUEABI:
-+        Config->SearchPaths.push_back("=/usr/lib/eabi");
-+        break;
-+      case llvm::Triple::EABIHF:
-+      case llvm::Triple::GNUEABIHF:
-+        Config->SearchPaths.push_back("=/usr/lib/eabihf");
-+        break;
-+      default:
-+        Config->SearchPaths.push_back("=/usr/lib/oabi");
-+        break;
-+      }
-+      break;
-+#if 0 // TODO
-+    case llvm::Triple::mips64:
-+    case llvm::Triple::mips64el:
-+      if (tools::mips::hasMipsAbiArg(Args, "o32"))
-+        Config->SearchPaths.push_back("=/usr/lib/o32");
-+      else if (tools::mips::hasMipsAbiArg(Args, "64"))
-+        Config->SearchPaths.push_back("=/usr/lib/64");
-+      break;
-+#endif
-+    case llvm::Triple::ppc:
-+      Config->SearchPaths.push_back("=/usr/lib/powerpc");
-+      break;
-+    case llvm::Triple::sparc:
-+      Config->SearchPaths.push_back("=/usr/lib/sparc");
-+      break;
-+    default:
-+      break;
-+    }
-+
-+    Config->SearchPaths.push_back("=/usr/lib");
-+  }
-+}
-+
- void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
-   ELFOptTable Parser;
-   opt::InputArgList Args = Parser.parse(ArgsArr.slice(1));
-@@ -378,6 +433,8 @@ void LinkerDriver::main(ArrayRef<const c
-     return;
-   }
- 
-+  setTargetTriple(ArgsArr[0], Args);
-+
-   // Handle -v or -version.
-   //
-   // A note about "compatible with GNU linkers" message: this is a hack for
-@@ -393,8 +450,10 @@ void LinkerDriver::main(ArrayRef<const c
-   // lot of "configure" scripts out there that are generated by old version
-   // of Libtool. We cannot convince every software developer to migrate to
-   // the latest version and re-generate scripts. So we have this hack.
--  if (Args.hasArg(OPT_v) || Args.hasArg(OPT_version))
-+  if (Args.hasArg(OPT_v) || Args.hasArg(OPT_version)) {
-     message(getLLDVersion() + " (compatible with GNU linkers)");
-+    message("Target: " + Config->TargetTriple.str());
-+  }
- 
-   if (const char *Path = getReproduceOption(Args)) {
-     // Note that --reproduce is a debug option so you can ignore it
-@@ -412,6 +471,7 @@ void LinkerDriver::main(ArrayRef<const c
- 
-   readConfigs(Args);
-   checkZOptions(Args);
-+  appendDefaultSearchPaths();
- 
-   // The behavior of -v or --version is a bit strange, but this is
-   // needed for compatibility with GNU linkers.
-@@ -746,6 +806,34 @@ static void parseClangOption(StringRef O
-   error(Msg + ": " + StringRef(Err).trim());
- }
- 
-+void LinkerDriver::setTargetTriple(StringRef argv0, opt::InputArgList &Args) {
-+  std::string TargetError;
-+
-+  // Firstly, see if user specified explicit --target
-+  StringRef TargetOpt = Args.getLastArgValue(OPT_target);
-+  if (!TargetOpt.empty()) {
-+    if (llvm::TargetRegistry::lookupTarget(TargetOpt, TargetError)) {
-+      Config->TargetTriple = llvm::Triple(TargetOpt);
-+      return;
-+    } else
-+      error("Unsupported --target=" + TargetOpt + ": " + TargetError);
-+  }
-+
-+  // Secondly, try to get it from program name prefix
-+  std::string ProgName = llvm::sys::path::stem(argv0);
-+  size_t LastComponent = ProgName.rfind('-');
-+  if (LastComponent != std::string::npos) {
-+    std::string Prefix = ProgName.substr(0, LastComponent);
-+    if (llvm::TargetRegistry::lookupTarget(Prefix, TargetError)) {
-+      Config->TargetTriple = llvm::Triple(Prefix);
-+      return;
-+    }
-+  }
-+
-+  // Finally, use the default target triple
-+  Config->TargetTriple = llvm::Triple(getDefaultTargetTriple());
-+}
-+
- // Initializes Config members by the command line options.
- void LinkerDriver::readConfigs(opt::InputArgList &Args) {
-   errorHandler().Verbose = Args.hasArg(OPT_verbose);
-@@ -779,7 +867,8 @@ void LinkerDriver::readConfigs(opt::Inpu
-   Config->CallGraphProfileSort = Args.hasFlag(
-       OPT_call_graph_profile_sort, OPT_no_call_graph_profile_sort, true);
-   Config->EnableNewDtags =
--      Args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags, true);
-+      Args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags,
-+                   !Config->TargetTriple.isOSNetBSD());
-   Config->Entry = Args.getLastArgValue(OPT_entry);
-   Config->ExecuteOnly =
-       Args.hasFlag(OPT_execute_only, OPT_no_execute_only, false);
-@@ -869,6 +958,8 @@ void LinkerDriver::readConfigs(opt::Inpu
-   Config->ZCombreloc = getZFlag(Args, "combreloc", "nocombreloc", true);
-   Config->ZCopyreloc = getZFlag(Args, "copyreloc", "nocopyreloc", true);
-   Config->ZExecstack = getZFlag(Args, "execstack", "noexecstack", false);
-+  Config->ZNognustack = hasZOption(Args, "nognustack") ||
-+    Config->TargetTriple.isOSNetBSD();
-   Config->ZGlobal = hasZOption(Args, "global");
-   Config->ZHazardplt = hasZOption(Args, "hazardplt");
-   Config->ZInitfirst = hasZOption(Args, "initfirst");
-@@ -1173,7 +1264,7 @@ void LinkerDriver::inferMachineType() {
- // each target.
- static uint64_t getMaxPageSize(opt::InputArgList &Args) {
-   uint64_t Val = args::getZOptionValue(Args, OPT_z, "max-page-size",
--                                       Target->DefaultMaxPageSize);
-+                                       lld::elf::Target->DefaultMaxPageSize);
-   if (!isPowerOf2_64(Val))
-     error("max-page-size: value isn't a power of 2");
-   return Val;
diff -r 23e462103715 -r a091ddeb0ff1 devel/lld/patches/patch-ELF_Driver.h
--- a/devel/lld/patches/patch-ELF_Driver.h      Sat Oct 19 14:01:36 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-$NetBSD: patch-ELF_Driver.h,v 1.1 2019/02/01 16:30:00 mgorny Exp $
-
-Add support for customizing LLD behavior on target triple.
-https://reviews.llvm.org/D56650
-
-Alter defaults for NetBSD targets:
-* add default library search paths
-
---- ELF/Driver.h.orig  2018-07-25 21:53:18.000000000 +0000
-+++ ELF/Driver.h
-@@ -31,7 +31,9 @@ public:
-   void addLibrary(StringRef Name);
- 
- private:
-+  void setTargetTriple(StringRef argv0, llvm::opt::InputArgList &Args);
-   void readConfigs(llvm::opt::InputArgList &Args);
-+  void appendDefaultSearchPaths();
-   void createFiles(llvm::opt::InputArgList &Args);
-   void inferMachineType();
-   template <class ELFT> void link(llvm::opt::InputArgList &Args);
diff -r 23e462103715 -r a091ddeb0ff1 devel/lld/patches/patch-ELF_Options.td
--- a/devel/lld/patches/patch-ELF_Options.td    Sat Oct 19 14:01:36 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-$NetBSD: patch-ELF_Options.td,v 1.1 2019/02/01 16:30:00 mgorny Exp $
-
-Add support for customizing LLD behavior on target triple.
-https://reviews.llvm.org/D56650
-
---- ELF/Options.td.orig        2018-07-30 17:36:38.000000000 +0000
-+++ ELF/Options.td
-@@ -303,6 +303,8 @@ defm symbol_ordering_file:
- 
- defm sysroot: Eq<"sysroot", "Set the system root">;
- 
-+defm target: Eq<"target", "Apply configuration defaults for a given target">;
-+
- def target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">;
- 
- def target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32 (default)">;
diff -r 23e462103715 -r a091ddeb0ff1 devel/lld/patches/patch-ELF_Writer.cpp
--- a/devel/lld/patches/patch-ELF_Writer.cpp    Sat Oct 19 14:01:36 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-$NetBSD: patch-ELF_Writer.cpp,v 1.1 2019/02/01 16:30:00 mgorny Exp $
-
-Add '-z nognustack' option to disable emitting PT_GNU_STACK.
-https://reviews.llvm.org/D56554
-
-Alter defaults for NetBSD targets:
-* disable PT_GNU_STACK (meaningless on NetBSD)
-
---- ELF/Writer.cpp.orig        2018-10-31 17:14:17.000000000 +0000
-+++ ELF/Writer.cpp
-@@ -1881,14 +1881,16 @@ template <class ELFT> std::vector<PhdrEn
-   if (OutputSection *Cmd = findSection(".openbsd.randomdata"))
-     AddHdr(PT_OPENBSD_RANDOMIZE, Cmd->getPhdrFlags())->add(Cmd);
- 
--  // PT_GNU_STACK is a special section to tell the loader to make the
--  // pages for the stack non-executable. If you really want an executable
--  // stack, you can pass -z execstack, but that's not recommended for
--  // security reasons.
--  unsigned Perm = PF_R | PF_W;
--  if (Config->ZExecstack)
--    Perm |= PF_X;
--  AddHdr(PT_GNU_STACK, Perm)->p_memsz = Config->ZStackSize;
-+  if (!Config->ZNognustack) {
-+    // PT_GNU_STACK is a special section to tell the loader to make the
-+    // pages for the stack non-executable. If you really want an executable
-+    // stack, you can pass -z execstack, but that's not recommended for
-+    // security reasons.
-+    unsigned Perm = PF_R | PF_W;
-+    if (Config->ZExecstack)
-+      Perm |= PF_X;
-+    AddHdr(PT_GNU_STACK, Perm)->p_memsz = Config->ZStackSize;
-+  }
- 
-   // PT_OPENBSD_WXNEEDED is a OpenBSD-specific header to mark the executable
-   // is expected to perform W^X violations, such as calling mprotect(2) or
diff -r 23e462103715 -r a091ddeb0ff1 devel/lld/patches/patch-docs_ld.lld.1
--- a/devel/lld/patches/patch-docs_ld.lld.1     Sat Oct 19 14:01:36 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-$NetBSD: patch-docs_ld.lld.1,v 1.2 2019/06/02 08:37:39 adam Exp $
-
-Add '-z nognustack' option to disable emitting PT_GNU_STACK.
-https://reviews.llvm.org/D56554
-
---- docs/ld.lld.1.orig 2019-01-17 13:46:36.000000000 +0000
-+++ docs/ld.lld.1
-@@ -511,6 +511,10 @@ Set the
- .Dv DF_1_NOOPEN
- flag to indicate that the object may not be opened by
- .Xr dlopen 3 .
-+.It Cm nognustack
-+Do not emit the
-+.Dv PT_GNU_STACK
-+segment.
- .It Cm norelro
- Do not indicate that portions of the object shold be mapped read-only
- after initial relocation processing.



Home | Main Index | Thread Index | Old Index