pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/lld devel/lld: import lld-7.0.1



details:   https://anonhg.NetBSD.org/pkgsrc/rev/369eb434d53e
branches:  trunk
changeset: 329165:369eb434d53e
user:      mgorny <mgorny%pkgsrc.org@localhost>
date:      Fri Feb 01 16:30:00 2019 +0000

description:
devel/lld: import lld-7.0.1

LLD is a linker from the LLVM project that is a drop-in replacement for system
linkers and runs much faster than them. It also provides features that are
useful for toolchain developers.

diffstat:

 devel/lld/DESCR                             |   11 +
 devel/lld/Makefile                          |   34 ++++
 devel/lld/PLIST                             |   49 +++++
 devel/lld/buildlink3.mk                     |   14 +
 devel/lld/distinfo                          |   18 ++
 devel/lld/options.mk                        |   20 ++
 devel/lld/patches/patch-CMakeLists.txt      |   16 +
 devel/lld/patches/patch-ELF_Config.h        |   37 ++++
 devel/lld/patches/patch-ELF_Driver.cpp      |  231 ++++++++++++++++++++++++++++
 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 +++
 14 files changed, 544 insertions(+), 0 deletions(-)

diffs (truncated from 600 to 300 lines):

diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/DESCR   Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,11 @@
+LLD is a linker from the LLVM project that is a drop-in replacement for system
+linkers and runs much faster than them. It also provides features that are
+useful for toolchain developers.
+
+The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS) and
+WebAssembly in descending order of completeness. Internally, LLD consists of
+several different linkers. The ELF port is the one that will be described in
+this document. The PE/COFF port is complete, including Windows debug info (PDB)
+support. The WebAssembly port is still a work in progress (See WebAssembly lld
+port). The Mach-O port is built based on a different architecture than
+the others. For the details about Mach-O, please read ATOM-based lld.
diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/Makefile        Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,34 @@
+# $NetBSD: Makefile,v 1.1 2019/02/01 16:30:00 mgorny Exp $
+
+PKGNAME=               lld-7.0.1
+DISTNAME=              ${PKGNAME}.src
+CATEGORIES=            devel
+MASTER_SITES=          http://llvm.org/releases/${PKGVERSION_NOREV}/
+EXTRACT_SUFX=          .tar.xz
+DISTFILES=             ${DEFAULT_DISTFILES}
+
+MAINTAINER=            mgorny%NetBSD.org@localhost
+HOMEPAGE=              http://lld.llvm.org/
+COMMENT=               The LLVM Linker
+LICENSE=               modified-bsd
+
+USE_LANGUAGES=         c c++11
+USE_CMAKE=             yes
+GCC_REQD+=             4.8
+
+CONFIGURE_DIRS=                ${WRKDIR}/build
+CMAKE_ARG_PATH=                ${WRKSRC}
+
+CMAKE_ARGS+=           -DCMAKE_BUILD_TYPE=Release
+CMAKE_ARGS+=           -DCMAKE_C_COMPILER=${CC:Q}
+CMAKE_ARGS+=           -DCMAKE_CXX_COMPILER=${CXX:Q}
+
+PYTHON_FOR_BUILD_ONLY= yes
+
+post-extract:
+       ${MKDIR} ${WRKDIR}/build
+
+.include "options.mk"
+.include "../../lang/python/tool.mk"
+.include "../../lang/llvm/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/PLIST   Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,49 @@
+@comment $NetBSD: PLIST,v 1.1 2019/02/01 16:30:00 mgorny Exp $
+bin/ld.lld
+bin/ld64.lld
+bin/lld
+bin/lld-link
+bin/wasm-ld
+include/lld/Common/Args.h
+include/lld/Common/Driver.h
+include/lld/Common/ErrorHandler.h
+include/lld/Common/LLVM.h
+include/lld/Common/Memory.h
+include/lld/Common/Reproduce.h
+include/lld/Common/Strings.h
+include/lld/Common/TargetOptionsCommandFlags.h
+include/lld/Common/Threads.h
+include/lld/Common/Timer.h
+include/lld/Common/Version.h
+include/lld/Core/AbsoluteAtom.h
+include/lld/Core/ArchiveLibraryFile.h
+include/lld/Core/Atom.h
+include/lld/Core/DefinedAtom.h
+include/lld/Core/Error.h
+include/lld/Core/File.h
+include/lld/Core/Instrumentation.h
+include/lld/Core/LinkingContext.h
+include/lld/Core/Node.h
+include/lld/Core/Pass.h
+include/lld/Core/PassManager.h
+include/lld/Core/Reader.h
+include/lld/Core/Reference.h
+include/lld/Core/Resolver.h
+include/lld/Core/SharedLibraryAtom.h
+include/lld/Core/SharedLibraryFile.h
+include/lld/Core/Simple.h
+include/lld/Core/SymbolTable.h
+include/lld/Core/UndefinedAtom.h
+include/lld/Core/Writer.h
+include/lld/ReaderWriter/MachOLinkingContext.h
+include/lld/ReaderWriter/YamlContext.h
+lib/liblldCOFF.a
+lib/liblldCommon.a
+lib/liblldCore.a
+lib/liblldDriver.a
+lib/liblldELF.a
+lib/liblldMachO.a
+lib/liblldMinGW.a
+lib/liblldReaderWriter.a
+lib/liblldWasm.a
+lib/liblldYAML.a
diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/buildlink3.mk   Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,14 @@
+# $NetBSD: buildlink3.mk,v 1.1 2019/02/01 16:30:00 mgorny Exp $
+
+BUILDLINK_TREE+=       lld
+
+.if !defined(LLD_BUILDLINK3_MK)
+LLD_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.lld+=    lld>=7.0.0
+BUILDLINK_PKGSRCDIR.lld?=      ../../devel/lld
+
+.include "../../lang/llvm/buildlink3.mk"
+.endif # LLD_BUILDLINK3_MK
+
+BUILDLINK_TREE+=       -lld
diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/distinfo        Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,18 @@
+$NetBSD: distinfo,v 1.1 2019/02/01 16:30:00 mgorny Exp $
+
+SHA1 (lld-7.0.1.src.tar.xz) = 3b69e107f27d466488838d5fa65bdfd77b885007
+RMD160 (lld-7.0.1.src.tar.xz) = 44e0e851b957fef86352ebe6c2a37096f8595dcb
+SHA512 (lld-7.0.1.src.tar.xz) = e5d3ed280d8ac6014cd6bbe080b11e2c4ebbae81dc14b637e779ec027d818dbae91c6f0de9e94bcecd6bdaa37f12c35141b5d81f0a15251d27932aa9bebd4047
+Size (lld-7.0.1.src.tar.xz) = 912812 bytes
+SHA1 (llvm-7.0.1.src.tar.xz) = f97632fcc3186eb0d396492ef8acfc807648580f
+RMD160 (llvm-7.0.1.src.tar.xz) = dae96c6f85afb60e73564dc40d02171d01ffdb8f
+SHA512 (llvm-7.0.1.src.tar.xz) = ac43a3cb71a53deb55e3693653847cf20bf6f5d9056f224e6956c96d63bc59ebee9404f088eec9cabe65337b4607a905ef931354b373cf64e0004c6905a6b5df
+Size (llvm-7.0.1.src.tar.xz) = 28311056 bytes
+SHA1 (patch-CMakeLists.txt) = df8e32f5f23bf2f2615a891177f61dc65359e955
+SHA1 (patch-ELF_Config.h) = 767eebd5787ae5351e3275f7d6666cd905f34f05
+SHA1 (patch-ELF_Driver.cpp) = d3ba099bf4a72a90cb126a6da4af9bdc7b97ba70
+SHA1 (patch-ELF_Driver.h) = e100fb0c86cc7d20b0f64919e73888a81a4836df
+SHA1 (patch-ELF_Options.td) = c8107a2c599b2444e52bdefe5f2dc539d277a092
+SHA1 (patch-ELF_Writer.cpp) = ab4ca25f832f20a5b4c80fe0f5f28822c09fb4ee
+SHA1 (patch-docs_ld.lld.1) = d61a228b5eb760a0ac4f691b9001d5505ebfe6ed
+SHA1 (patch-test_ELF_gnustack.s) = b3827436dcfc67d51b8d293b11538808537ddeec
diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/options.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/options.mk      Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,20 @@
+# $NetBSD: options.mk,v 1.1 2019/02/01 16:30:00 mgorny Exp $
+
+PKG_OPTIONS_VAR=       PKG_OPTIONS.lld
+PKG_SUPPORTED_OPTIONS= tests
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mtests)
+DISTFILES+=            llvm-${PKGVERSION_NOREV}.src${EXTRACT_SUFX}
+CMAKE_ARGS+=           -DLLVM_CONFIG_PATH=${LLVM_CONFIG_PATH:Q}
+CMAKE_ARGS+=           -DLLVM_INCLUDE_TESTS=ON
+CMAKE_ARGS+=           -DLLVM_BUILD_TESTS=ON
+CMAKE_ARGS+=           -DLLVM_MAIN_SRC_DIR=${WRKDIR}/llvm-${PKGVERSION_NOREV}.src
+CMAKE_ARGS+=           -DLLVM_EXTERNAL_LIT=${WRKDIR}/llvm-${PKGVERSION_NOREV}.src/utils/lit/lit.py
+REPLACE_PYTHON+=       ${WRKDIR}/llvm-${PKGVERSION_NOREV}.src/utils/lit/lit.py
+TEST_TARGET=           check-lld  # failing tests fixed in 8.0
+TEST_ENV+=             LD_LIBRARY_PATH=${WRKDIR}/build/lib
+.else
+CMAKE_ARGS+=           -DLLVM_INCLUDE_TESTS=OFF
+.endif
diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/patches/patch-CMakeLists.txt
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/patches/patch-CMakeLists.txt    Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-CMakeLists.txt,v 1.1 2019/02/01 16:30:00 mgorny 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
++++ CMakeLists.txt
+@@ -86,7 +86,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
+-          AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
+           AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
+         add_subdirectory(${UNITTEST_DIR} utils/unittest)
+       endif()
diff -r f533c49d3dd9 -r 369eb434d53e devel/lld/patches/patch-ELF_Config.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/patches/patch-ELF_Config.h      Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,37 @@
+$NetBSD: patch-ELF_Config.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
+
+Add '-z nognustack' option to disable emitting PT_GNU_STACK.
+https://reviews.llvm.org/D56554
+
+--- ELF/Config.h.orig  2018-07-31 13:41:59.000000000 +0000
++++ ELF/Config.h
+@@ -14,6 +14,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"
+@@ -185,6 +186,7 @@ struct Configuration {
+   bool ZKeepTextSectionPrefix;
+   bool ZNodelete;
+   bool ZNodlopen;
++  bool ZNognustack;
+   bool ZNow;
+   bool ZOrigin;
+   bool ZRelro;
+@@ -267,6 +269,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 -r f533c49d3dd9 -r 369eb434d53e devel/lld/patches/patch-ELF_Driver.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/lld/patches/patch-ELF_Driver.cpp    Fri Feb 01 16:30:00 2019 +0000
@@ -0,0 +1,231 @@
+$NetBSD: patch-ELF_Driver.cpp,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
+
+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        2018-07-31 21:58:26.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>
+@@ -309,6 +310,9 @@ static void checkOptions(opt::InputArgLi
+ 
+     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;
+   }
+ }
+ 
+@@ -341,7 +345,7 @@ static bool isKnown(StringRef S) {
+          S == "execstack" || S == "hazardplt" || S == "initfirst" ||
+          S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" ||
+          S == "nocombreloc" || S == "nocopyreloc" || S == "nodelete" ||
+-         S == "nodlopen" || S == "noexecstack" ||
++         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" ||
+@@ -355,6 +359,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;



Home | Main Index | Thread Index | Old Index