diff options
author | kamil <kamil@pkgsrc.org> | 2019-11-03 12:10:29 +0000 |
---|---|---|
committer | kamil <kamil@pkgsrc.org> | 2019-11-03 12:10:29 +0000 |
commit | 45396e654ed10a1b396ff5378d3e64cde661edca (patch) | |
tree | d86dd0f0cbec5bc711c2764fa59da70bb49640f4 /devel/lld | |
parent | b2e4a5f46228c81e46d7dd51126346fc05230c3d (diff) | |
download | pkgsrc-45396e654ed10a1b396ff5378d3e64cde661edca.tar.gz |
lld: Sync local patches with merged and pending patches upstream
Cherry-pick upstream patch commit 2a0fcae3d4d1fd85d6ae8378d7c6f12430c0087d
[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STAC dummy option for an AArch64 erratum.
[LLD] Add NetBSD support as a new flavor of LLD (nb.lld)
https://reviews.llvm.org/D69755
Clang >=clang-9.0.0nb3 is required.
Diffstat (limited to 'devel/lld')
-rw-r--r-- | devel/lld/Makefile | 4 | ||||
-rw-r--r-- | devel/lld/PLIST | 3 | ||||
-rw-r--r-- | devel/lld/distinfo | 21 | ||||
-rw-r--r-- | devel/lld/patches/patch-CMakeLists.txt | 17 | ||||
-rw-r--r-- | devel/lld/patches/patch-ELF_Arch_AArch64.cpp | 22 | ||||
-rw-r--r-- | devel/lld/patches/patch-ELF_Config.h | 42 | ||||
-rw-r--r-- | devel/lld/patches/patch-ELF_Driver.cpp | 201 | ||||
-rw-r--r-- | devel/lld/patches/patch-ELF_Options.td | 20 | ||||
-rw-r--r-- | devel/lld/patches/patch-ELF_Writer.cpp | 6 | ||||
-rw-r--r-- | devel/lld/patches/patch-docs_ld.lld.1 | 11 | ||||
-rw-r--r-- | devel/lld/patches/patch-test_ELF_gnustack.s | 10 |
11 files changed, 66 insertions, 291 deletions
diff --git a/devel/lld/Makefile b/devel/lld/Makefile index e617dbbf61a..96ca39d4596 100644 --- a/devel/lld/Makefile +++ b/devel/lld/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.10 2019/10/24 11:52:21 tnn Exp $ +# $NetBSD: Makefile,v 1.11 2019/11/03 12:10:29 kamil Exp $ DISTNAME= lld-9.0.0.src PKGNAME= ${DISTNAME:S/.src//} -PKGREVISION= 2 +PKGREVISION= 3 CATEGORIES= devel MASTER_SITES= http://releases.llvm.org/${PKGVERSION_NOREV}/ EXTRACT_SUFX= .tar.xz diff --git a/devel/lld/PLIST b/devel/lld/PLIST index 5ac49b6e529..9347f3a9bb6 100644 --- a/devel/lld/PLIST +++ b/devel/lld/PLIST @@ -1,8 +1,9 @@ -@comment $NetBSD: PLIST,v 1.2 2019/10/19 14:01:36 adam Exp $ +@comment $NetBSD: PLIST,v 1.3 2019/11/03 12:10:29 kamil Exp $ bin/ld.lld bin/ld64.lld bin/lld bin/lld-link +bin/nb.lld bin/wasm-ld include/lld/Common/Args.h include/lld/Common/Driver.h diff --git a/devel/lld/distinfo b/devel/lld/distinfo index 0a8351ccb9a..edbfee24131 100644 --- a/devel/lld/distinfo +++ b/devel/lld/distinfo @@ -1,14 +1,17 @@ -$NetBSD: distinfo,v 1.6 2019/10/21 22:07:58 rjs Exp $ +$NetBSD: distinfo,v 1.7 2019/11/03 12:10:29 kamil Exp $ SHA1 (lld-9.0.0.src.tar.xz) = 021a8c38cf27d63db37d939c7cdec46ffd627be2 RMD160 (lld-9.0.0.src.tar.xz) = d46b068f4de55d174be71e061aa38f7d4d1499dc SHA512 (lld-9.0.0.src.tar.xz) = bc4812232840ef5edbd8edf1d1a329e85a4bfd3a7859fe322e11dd053435e722c6f1140a718fd2b3524ee9783a357178d2ba30d12519847bd3acc294698007f3 Size (lld-9.0.0.src.tar.xz) = 1100608 bytes -SHA1 (patch-CMakeLists.txt) = df8e32f5f23bf2f2615a891177f61dc65359e955 -SHA1 (patch-ELF_Arch_AArch64.cpp) = 45eb8f69b92f8ba764372993363dbce88b50a310 -SHA1 (patch-ELF_Config.h) = 760658ef2d90e8d44ae6c1ef76a183613f445264 -SHA1 (patch-ELF_Driver.cpp) = eaf5a3cd01a82421205831dce86db92bfb4001bc -SHA1 (patch-ELF_Options.td) = 8e228dee43511efc7fd6107e817288067c393145 -SHA1 (patch-ELF_Writer.cpp) = 210b0a8b60885456cb037d9925c504874efd0e35 -SHA1 (patch-docs_ld.lld.1) = a6865d0099216094422aede3d65f43ee6fee22fe -SHA1 (patch-test_ELF_gnustack.s) = 22f5eb19e588cc0c1055fd932d7a7b22ecd70e20 +SHA1 (patch-CMakeLists.txt) = 87d32f66488541ba68e219f5fa83646b48bf9c71 +SHA1 (patch-ELF_Config.h) = 6ad0642b602f1bdfead45e3e3d71e9718fdd80b5 +SHA1 (patch-ELF_Driver.cpp) = 113705d763af35635ee69e127c9c757c9d0c2597 +SHA1 (patch-ELF_Options.td) = 22a1f293681b86a9aac87624efcfeeb20a4ba51c +SHA1 (patch-ELF_Writer.cpp) = 8c2d794885826a153b3ec6fa3149093036b98750 +SHA1 (patch-docs_ld.lld.1) = c2d156d3d7af6de195f9c2f3eceb978d65c8d883 +SHA1 (patch-test_ELF_gnustack.s) = 58eb43e952a85bb8f2cb7a665a625164ee564dd2 +SHA1 (patch-tools_lld_lld.cpp) = bc3662191bf6e50c808d188707c9abfdb4786dbf +SHA1 (patch-tools_nb.lld_CMakeLists.txt) = 231ed112512d23001a8e9d1d1821838a483c2e37 +SHA1 (patch-tools_nb.lld_Options.td) = d56ff977f24d97eda30f10aae5818c618b3c7915 +SHA1 (patch-tools_nb.lld_nb.lld.cpp) = 11a69572b0ec28b9de576249bf3217acdcebee22 diff --git a/devel/lld/patches/patch-CMakeLists.txt b/devel/lld/patches/patch-CMakeLists.txt index 211f3f1cfaa..37730dff27e 100644 --- a/devel/lld/patches/patch-CMakeLists.txt +++ b/devel/lld/patches/patch-CMakeLists.txt @@ -1,12 +1,15 @@ -$NetBSD: patch-CMakeLists.txt,v 1.1 2019/02/01 16:30:00 mgorny Exp $ +$NetBSD: patch-CMakeLists.txt,v 1.2 2019/11/03 12:10:29 kamil Exp $ LLD 7.0.1 is incompatible with gtest version in pkgsrc. Remove the condition that prevents it from building its own copy when system version is installed. ---- CMakeLists.txt.orig 2017-11-17 18:14:09.000000000 +0000 +[LLD] Add NetBSD support as a new flavor of LLD (nb.lld) +https://reviews.llvm.org/D69755 + +--- CMakeLists.txt.orig 2019-08-26 12:32:18.000000000 +0000 +++ CMakeLists.txt -@@ -86,7 +86,6 @@ Please install Python or specify the PYT +@@ -85,7 +85,6 @@ Please install Python or specify the PYT endif() set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h @@ -14,3 +17,11 @@ version is installed. AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) add_subdirectory(${UNITTEST_DIR} utils/unittest) endif() +@@ -212,6 +211,7 @@ endif() + add_subdirectory(Common) + add_subdirectory(lib) + add_subdirectory(tools/lld) ++add_subdirectory(tools/nb.lld) + + if (LLVM_INCLUDE_TESTS) + add_subdirectory(test) diff --git a/devel/lld/patches/patch-ELF_Arch_AArch64.cpp b/devel/lld/patches/patch-ELF_Arch_AArch64.cpp deleted file mode 100644 index 13bc6980843..00000000000 --- a/devel/lld/patches/patch-ELF_Arch_AArch64.cpp +++ /dev/null @@ -1,22 +0,0 @@ -$NetBSD: patch-ELF_Arch_AArch64.cpp,v 1.1 2019/10/21 22:07:58 rjs Exp $ - -Set correct base address on NetBSD. - ---- ELF/Arch/AArch64.cpp.orig 2019-07-16 05:50:45.000000000 +0000 -+++ ELF/Arch/AArch64.cpp -@@ -66,9 +66,12 @@ AArch64::AArch64() { - pltHeaderSize = 32; - defaultMaxPageSize = 65536; - -- // Align to the 2 MiB page size (known as a superpage or huge page). -- // FreeBSD automatically promotes 2 MiB-aligned allocations. -- defaultImageBase = 0x200000; -+ if (config->targetTriple.isOSNetBSD()) -+ defaultImageBase = 0x200100000; -+ else -+ // Align to the 2 MiB page size (known as a superpage or huge page). -+ // FreeBSD automatically promotes 2 MiB-aligned allocations. -+ defaultImageBase = 0x200000; - - needsThunks = true; - } diff --git a/devel/lld/patches/patch-ELF_Config.h b/devel/lld/patches/patch-ELF_Config.h index 331a269b059..8b2648a6a5b 100644 --- a/devel/lld/patches/patch-ELF_Config.h +++ b/devel/lld/patches/patch-ELF_Config.h @@ -1,24 +1,13 @@ -$NetBSD: patch-ELF_Config.h,v 1.4 2019/10/21 22:07:58 rjs Exp $ +$NetBSD: patch-ELF_Config.h,v 1.5 2019/11/03 12:10:29 kamil 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 +Cherry-pick upstream patch commit 2a0fcae3d4d1fd85d6ae8378d7c6f12430c0087d +[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STAC dummy option for an AArch64 erratum. Add dummy option for an AArch64 erratum. --- ELF/Config.h.orig 2019-07-16 05:50:45.000000000 +0000 +++ ELF/Config.h -@@ -13,6 +13,7 @@ - #include "llvm/ADT/MapVector.h" - #include "llvm/ADT/StringRef.h" - #include "llvm/ADT/StringSet.h" -+#include "llvm/ADT/Triple.h" - #include "llvm/BinaryFormat/ELF.h" - #include "llvm/Support/CachePruning.h" - #include "llvm/Support/CodeGen.h" -@@ -61,6 +62,9 @@ enum class Target2Policy { Abs, Rel, Got +@@ -61,6 +61,9 @@ enum class Target2Policy { Abs, Rel, Got // For tracking ARM Float Argument PCS enum class ARMVFPArgKind { Default, Base, VFP, ToolChain }; @@ -28,7 +17,7 @@ Add dummy option for an AArch64 erratum. struct SymbolVersion { llvm::StringRef name; bool isExternCpp; -@@ -146,6 +150,7 @@ struct Configuration { +@@ -146,6 +149,7 @@ struct Configuration { bool enableNewDtags; bool executeOnly; bool exportDynamic; @@ -36,15 +25,7 @@ Add dummy option for an AArch64 erratum. bool fixCortexA53Errata843419; bool forceBTI; bool formatBinary = false; -@@ -206,6 +211,7 @@ struct Configuration { - bool zNodefaultlib; - bool zNodelete; - bool zNodlopen; -+ bool zNognustack; - bool zNow; - bool zOrigin; - bool zRelro; -@@ -214,6 +220,7 @@ struct Configuration { +@@ -214,6 +218,7 @@ struct Configuration { bool zRetpolineplt; bool zWxneeded; DiscardPolicy discard; @@ -52,14 +33,3 @@ Add dummy option for an AArch64 erratum. ICFLevel icf; OrphanHandlingPolicy orphanHandling; SortSectionPolicy sortSection; -@@ -304,6 +311,10 @@ struct Configuration { - - // 4 for ELF32, 8 for ELF64. - int wordsize; -+ -+ // Target triple, inferred from program name or defaulted to LLVM -+ // default target. -+ llvm::Triple targetTriple; - }; - - // The only instance of Configuration struct. diff --git a/devel/lld/patches/patch-ELF_Driver.cpp b/devel/lld/patches/patch-ELF_Driver.cpp index f7cbd9fc49f..3cd592ad3e0 100644 --- a/devel/lld/patches/patch-ELF_Driver.cpp +++ b/devel/lld/patches/patch-ELF_Driver.cpp @@ -1,48 +1,22 @@ -$NetBSD: patch-ELF_Driver.cpp,v 1.5 2019/10/21 22:07:58 rjs Exp $ +$NetBSD: patch-ELF_Driver.cpp,v 1.6 2019/11/03 12:10:29 kamil Exp $ -Add support for customizing LLD behavior on target triple. -https://reviews.llvm.org/D56650 +Cherry-pick upstream patch commit 2a0fcae3d4d1fd85d6ae8378d7c6f12430c0087d +[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STAC dummy option for an AArch64 erratum. -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 - -Add dummy handler for an AArch64 erratum. +Add dummy option for an AArch64 erratum. --- ELF/Driver.cpp.orig 2019-07-17 14:54:02.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> -@@ -73,6 +74,8 @@ LinkerDriver *elf::driver; - - static void setConfigs(opt::InputArgList &args); - static void readConfigs(opt::InputArgList &args); -+static void appendDefaultSearchPaths(void); -+static void setTargetTriple(StringRef argv0, opt::InputArgList &args); - - bool elf::link(ArrayRef<const char *> args, bool canExitEarly, - raw_ostream &error) { -@@ -129,7 +132,7 @@ static std::tuple<ELFKind, uint16_t, uin +@@ -129,7 +129,7 @@ static std::tuple<ELFKind, uint16_t, uin std::pair<ELFKind, uint16_t> ret = StringSwitch<std::pair<ELFKind, uint16_t>>(s) .Cases("aarch64elf", "aarch64linux", "aarch64_elf64_le_vec", - {ELF64LEKind, EM_AARCH64}) -+ "aarch64nbsd", {ELF64LEKind, EM_AARCH64}) ++ "aarch64nbsd", {ELF64LEKind, EM_AARCH64}) .Cases("armelf", "armelf_linux_eabi", {ELF32LEKind, EM_ARM}) .Case("elf32_x86_64", {ELF32LEKind, EM_X86_64}) .Cases("elf32btsmip", "elf32btsmipn32", {ELF32BEKind, EM_MIPS}) -@@ -296,6 +299,9 @@ static void checkOptions() { +@@ -296,6 +296,9 @@ static void checkOptions() { if (config->emachine == EM_MIPS && config->gnuHash) error("the .gnu.hash section is not compatible with the MIPS target"); @@ -52,17 +26,7 @@ Add dummy handler for an AArch64 erratum. if (config->fixCortexA53Errata843419 && config->emachine != EM_AARCH64) error("--fix-cortex-a53-843419 is only supported on AArch64 targets"); -@@ -336,6 +342,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; - } - - if (config->zRetpolineplt && config->requireCET) -@@ -373,6 +382,20 @@ static bool getZFlag(opt::InputArgList & +@@ -373,6 +376,20 @@ static bool getZFlag(opt::InputArgList & return Default; } @@ -83,147 +47,15 @@ Add dummy handler for an AArch64 erratum. static bool isKnownZFlag(StringRef s) { return s == "combreloc" || s == "copyreloc" || s == "defs" || s == "execstack" || s == "global" || s == "hazardplt" || -@@ -380,6 +403,7 @@ static bool isKnownZFlag(StringRef s) { +@@ -380,6 +397,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 == "nognustack" || s == "nokeep-text-section-prefix" || s == "norelro" || s == "notext" || s == "now" || s == "origin" || s == "relro" || s == "retpolineplt" || s == "rodynamic" || s == "text" || s == "wxneeded" || -@@ -394,6 +418,56 @@ static void checkZOptions(opt::InputArgL - error("unknown -z value: " + StringRef(arg->getValue())); - } - -+static void 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)); -@@ -408,6 +482,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 -@@ -423,8 +499,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 -@@ -442,6 +520,8 @@ void LinkerDriver::main(ArrayRef<const c - - readConfigs(args); - -+ appendDefaultSearchPaths(); -+ - // The behavior of -v or --version is a bit strange, but this is - // needed for compatibility with GNU linkers. - if (args.hasArg(OPT_v) && !args.hasArg(OPT_INPUT)) -@@ -781,6 +861,34 @@ static void parseClangOption(StringRef o - error(msg + ": " + StringRef(err).trim()); - } - -+static void 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. - static void readConfigs(opt::InputArgList &args) { - errorHandler().verbose = args.hasArg(OPT_verbose); -@@ -820,7 +928,8 @@ static void readConfigs(opt::InputArgLis - 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); -@@ -828,6 +937,7 @@ static void readConfigs(opt::InputArgLis +@@ -828,6 +846,7 @@ static void readConfigs(opt::InputArgLis args.hasFlag(OPT_export_dynamic, OPT_no_export_dynamic, false); config->filterList = args::getStrings(args, OPT_filter); config->fini = args.getLastArgValue(OPT_fini, "_fini"); @@ -231,7 +63,7 @@ Add dummy handler for an AArch64 erratum. config->fixCortexA53Errata843419 = args.hasArg(OPT_fix_cortex_a53_843419); config->forceBTI = args.hasArg(OPT_force_bti); config->requireCET = args.hasArg(OPT_require_cet); -@@ -921,6 +1031,7 @@ static void readConfigs(opt::InputArgLis +@@ -921,6 +940,7 @@ static void readConfigs(opt::InputArgLis config->zCopyreloc = getZFlag(args, "copyreloc", "nocopyreloc", true); config->zExecstack = getZFlag(args, "execstack", "noexecstack", false); config->zGlobal = hasZOption(args, "global"); @@ -239,12 +71,3 @@ Add dummy handler for an AArch64 erratum. config->zHazardplt = hasZOption(args, "hazardplt"); config->zIfuncNoplt = hasZOption(args, "ifunc-noplt"); config->zInitfirst = hasZOption(args, "initfirst"); -@@ -1234,7 +1345,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"); - if (config->nmagic || config->omagic) { diff --git a/devel/lld/patches/patch-ELF_Options.td b/devel/lld/patches/patch-ELF_Options.td index 116bea15efe..985bef8b765 100644 --- a/devel/lld/patches/patch-ELF_Options.td +++ b/devel/lld/patches/patch-ELF_Options.td @@ -1,13 +1,10 @@ -$NetBSD: patch-ELF_Options.td,v 1.3 2019/10/21 22:07:58 rjs Exp $ +$NetBSD: patch-ELF_Options.td,v 1.4 2019/11/03 12:10:29 kamil Exp $ -Add support for customizing LLD behavior on target triple. -https://reviews.llvm.org/D56650 +Add dummy option for an AArch64 erratum. -Add support for a dummy AArch64 erratum. - ---- ELF/Options.td.orig 2019-02-20 08:21:37.000000000 +0000 +--- ELF/Options.td.orig 2019-07-17 14:54:02.000000000 +0000 +++ ELF/Options.td -@@ -160,6 +160,9 @@ defm filter: Eq<"filter", "Set DT_FILTER +@@ -168,6 +168,9 @@ defm filter: Eq<"filter", "Set DT_FILTER defm fini: Eq<"fini", "Specify a finalizer function">, MetaVarName<"<symbol>">; @@ -17,12 +14,3 @@ Add support for a dummy AArch64 erratum. def fix_cortex_a53_843419: F<"fix-cortex-a53-843419">, HelpText<"Apply fixes for AArch64 Cortex-A53 erratum 843419">; -@@ -316,6 +319,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 --git a/devel/lld/patches/patch-ELF_Writer.cpp b/devel/lld/patches/patch-ELF_Writer.cpp index ba661a7a968..52aead52ba0 100644 --- a/devel/lld/patches/patch-ELF_Writer.cpp +++ b/devel/lld/patches/patch-ELF_Writer.cpp @@ -1,7 +1,7 @@ -$NetBSD: patch-ELF_Writer.cpp,v 1.3 2019/10/21 22:07:58 rjs Exp $ +$NetBSD: patch-ELF_Writer.cpp,v 1.4 2019/11/03 12:10:29 kamil Exp $ -Add '-z nognustack' option to disable emitting PT_GNU_STACK. -https://reviews.llvm.org/D56554 +Cherry-pick upstream patch commit 2a0fcae3d4d1fd85d6ae8378d7c6f12430c0087d +[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STAC dummy option for an AArch64 erratum. --- ELF/Writer.cpp.orig 2019-09-06 11:20:15.000000000 +0000 +++ ELF/Writer.cpp diff --git a/devel/lld/patches/patch-docs_ld.lld.1 b/devel/lld/patches/patch-docs_ld.lld.1 index 1eff2f32c10..9ee1e0053de 100644 --- a/devel/lld/patches/patch-docs_ld.lld.1 +++ b/devel/lld/patches/patch-docs_ld.lld.1 @@ -1,11 +1,11 @@ -$NetBSD: patch-docs_ld.lld.1,v 1.4 2019/10/21 22:07:58 rjs Exp $ +$NetBSD: patch-docs_ld.lld.1,v 1.5 2019/11/03 12:10:29 kamil Exp $ -Add '-z nognustack' option to disable emitting PT_GNU_STACK. -https://reviews.llvm.org/D56554 +Cherry-pick upstream patch commit 2a0fcae3d4d1fd85d6ae8378d7c6f12430c0087d +[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STAC dummy option for an AArch64 erratum. ---- docs/ld.lld.1.orig 2019-01-17 13:46:36.000000000 +0000 +--- docs/ld.lld.1.orig 2019-11-03 11:37:33.105878671 +0000 +++ docs/ld.lld.1 -@@ -511,6 +511,10 @@ Set the +@@ -612,6 +612,11 @@ Set the .Dv DF_1_NOOPEN flag to indicate that the object may not be opened by .Xr dlopen 3 . @@ -13,6 +13,7 @@ https://reviews.llvm.org/D56554 +Do not emit the +.Dv PT_GNU_STACK +segment. ++.Pp .It Cm norelro Do not indicate that portions of the object shold be mapped read-only after initial relocation processing. diff --git a/devel/lld/patches/patch-test_ELF_gnustack.s b/devel/lld/patches/patch-test_ELF_gnustack.s index 7c3edb0948a..38a7bfc1038 100644 --- a/devel/lld/patches/patch-test_ELF_gnustack.s +++ b/devel/lld/patches/patch-test_ELF_gnustack.s @@ -1,7 +1,7 @@ -$NetBSD: patch-test_ELF_gnustack.s,v 1.3 2019/10/21 22:07:58 rjs Exp $ +$NetBSD: patch-test_ELF_gnustack.s,v 1.4 2019/11/03 12:10:29 kamil Exp $ -Add '-z nognustack' option to disable emitting PT_GNU_STACK. -https://reviews.llvm.org/D56554 +Cherry-pick upstream patch commit 2a0fcae3d4d1fd85d6ae8378d7c6f12430c0087d +[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STAC dummy option for an AArch64 erratum. --- test/ELF/gnustack.s.orig 2019-05-01 05:49:01.000000000 +0000 +++ test/ELF/gnustack.s @@ -9,8 +9,8 @@ https://reviews.llvm.org/D56554 # RUN: ld.lld %t1 -o %t -z noexecstack # RUN: llvm-readobj --program-headers -S %t | FileCheck --check-prefix=RW %s -+# RUN: ld.lld %t1 -o %t -z noexecstack -+# RUN: llvm-readobj --program-headers -S %t | FileCheck --check-prefix=NOGNUSTACK %s ++# RUN: ld.lld %t1 -o %t -z nognustack ++# RUN: llvm-readobj --program-headers -s %t | FileCheck --check-prefix=NOGNUSTACK %s + # RW: Type: PT_GNU_STACK # RW-NEXT: Offset: 0x0 |