Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jan 2017 20:59:10 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r312964 - in vendor/lld/dist: . ELF cmake/modules docs test/ELF/linkerscript
Message-ID:  <201701292059.v0TKxAZC075357@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sun Jan 29 20:59:10 2017
New Revision: 312964
URL: https://svnweb.freebsd.org/changeset/base/312964

Log:
  Vendor import of lld release_40 branch r293443:
  https://llvm.org/svn/llvm-project/lld/branches/release_40@293443

Added:
  vendor/lld/dist/test/ELF/linkerscript/common-assign.s   (contents, props changed)
Modified:
  vendor/lld/dist/CMakeLists.txt
  vendor/lld/dist/ELF/LinkerScript.cpp
  vendor/lld/dist/ELF/SyntheticSections.h
  vendor/lld/dist/cmake/modules/AddLLD.cmake
  vendor/lld/dist/docs/ReleaseNotes.rst

Modified: vendor/lld/dist/CMakeLists.txt
==============================================================================
--- vendor/lld/dist/CMakeLists.txt	Sun Jan 29 20:59:08 2017	(r312963)
+++ vendor/lld/dist/CMakeLists.txt	Sun Jan 29 20:59:10 2017	(r312964)
@@ -42,6 +42,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRE
   include_directories("${LLVM_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS})
   link_directories(${LLVM_LIBRARY_DIRS})
 
+  set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
 

Modified: vendor/lld/dist/ELF/LinkerScript.cpp
==============================================================================
--- vendor/lld/dist/ELF/LinkerScript.cpp	Sun Jan 29 20:59:08 2017	(r312963)
+++ vendor/lld/dist/ELF/LinkerScript.cpp	Sun Jan 29 20:59:10 2017	(r312964)
@@ -918,12 +918,7 @@ const OutputSectionBase *LinkerScript<EL
     return CurOutSec ? CurOutSec : (*OutputSections)[0];
   }
 
-  if (auto *DR = dyn_cast_or_null<DefinedRegular<ELFT>>(Sym))
-    return DR->Section ? DR->Section->OutSec : nullptr;
-  if (auto *DS = dyn_cast_or_null<DefinedSynthetic>(Sym))
-    return DS->Section;
-
-  return nullptr;
+  return SymbolTableSection<ELFT>::getOutputSection(Sym);
 }
 
 // Returns indices of ELF headers containing specific section, identified

Modified: vendor/lld/dist/ELF/SyntheticSections.h
==============================================================================
--- vendor/lld/dist/ELF/SyntheticSections.h	Sun Jan 29 20:59:08 2017	(r312963)
+++ vendor/lld/dist/ELF/SyntheticSections.h	Sun Jan 29 20:59:10 2017	(r312964)
@@ -372,6 +372,8 @@ public:
 
   ArrayRef<SymbolTableEntry> getSymbols() const { return Symbols; }
 
+  static const OutputSectionBase *getOutputSection(SymbolBody *Sym);
+
   unsigned NumLocals = 0;
   StringTableSection<ELFT> &StrTabSec;
 
@@ -379,8 +381,6 @@ private:
   void writeLocalSymbols(uint8_t *&Buf);
   void writeGlobalSymbols(uint8_t *Buf);
 
-  const OutputSectionBase *getOutputSection(SymbolBody *Sym);
-
   // A vector of symbols and their string table offsets.
   std::vector<SymbolTableEntry> Symbols;
 };

Modified: vendor/lld/dist/cmake/modules/AddLLD.cmake
==============================================================================
--- vendor/lld/dist/cmake/modules/AddLLD.cmake	Sun Jan 29 20:59:08 2017	(r312963)
+++ vendor/lld/dist/cmake/modules/AddLLD.cmake	Sun Jan 29 20:59:10 2017	(r312964)
@@ -1,6 +1,38 @@
 macro(add_lld_library name)
-  llvm_add_library(${name} ${ARGN})
+  cmake_parse_arguments(ARG
+    "SHARED"
+    ""
+    ""
+    ${ARGN})
+  if(ARG_SHARED)
+    set(ARG_ENABLE_SHARED SHARED)
+  endif()
+  llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS})
   set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
+
+  if (LLD_BUILD_TOOLS)
+    if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+        NOT LLVM_DISTRIBUTION_COMPONENTS)
+      set(export_to_lldtargets EXPORT lldTargets)
+      set_property(GLOBAL PROPERTY LLD_HAS_EXPORTS True)
+    endif()
+
+    install(TARGETS ${name}
+      COMPONENT ${name}
+      ${export_to_lldtargets}
+      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+      RUNTIME DESTINATION bin)
+
+    if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+      add_custom_target(install-${name}
+        DEPENDS ${name}
+        COMMAND "${CMAKE_COMMAND}"
+          -DCMAKE_INSTALL_COMPONENT=${name}
+          -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+    endif()
+    set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
+  endif()
 endmacro(add_lld_library)
 
 macro(add_lld_executable name)

Modified: vendor/lld/dist/docs/ReleaseNotes.rst
==============================================================================
--- vendor/lld/dist/docs/ReleaseNotes.rst	Sun Jan 29 20:59:08 2017	(r312963)
+++ vendor/lld/dist/docs/ReleaseNotes.rst	Sun Jan 29 20:59:10 2017	(r312964)
@@ -11,25 +11,94 @@ LLD 4.0.0 Release Notes
 Introduction
 ============
 
-This document contains the release notes for the LLD linker, release 4.0.0.
+LLD is a linker which supports ELF (Unix), COFF (Windows) and Mach-O
+(macOS). It is generally faster than the GNU BFD/gold linkers or the
+MSVC linker.
+
+LLD is designed to be a drop-in replacmenet for the system linkers, so
+that users don't need to change their build systems other than swapping
+the linker command.
+
+This document contains the release notes for LLD 4.0.0.
 Here we describe the status of LLD, including major improvements
 from the previous release. All LLD releases may be downloaded
 from the `LLVM releases web site <http://llvm.org/releases/>`_.
 
-Non-comprehensive list of changes in this release
-=================================================
+
+What's New in LLD 4.0?
+======================
 
 ELF Improvements
 ----------------
 
-* Initial support for LTO.
+LLD provides much better compatibility with the GNU linker than before.
+Now it is able to link the entire FreeBSD base system including the kernel
+out of the box. We are working closely with the FreeBSD project to
+make it usable as the system linker in a future release of the operating
+system.
+
+Multi-threading performance has been improved, and multi-threading
+is now enabled by default. Combined with other optimizations, LLD 4.0
+is about 1.5 times faster than LLD 3.9 when linking large programs
+in our test environment.
+
+Other notable changes are listed below:
+
+* Error messages contain more information than before. If debug info
+  is available, the linker prints out not only the object file name
+  but the source location of unresolved symbols.
+
+* Error messages are printed in red just like Clang by default. You
+  can disable it by passing -no-color-diagnostics.
+
+* LLD's version string is now embedded in a .comment section in the
+  result output file. You can dump it with this command: ``objdump -j -s
+  .comment <file>``.
+
+* The -Map option is supported. With that, you can print out section
+  and symbol information to a specified file. This feature is useful
+  for analyzing link results.
+
+* The file format for the -reproduce option has changed from cpio to
+  tar.
+
+* When creating a copy relocation for a symbol, LLD now scans the
+  DSO's header to see if the symbol is in a read-only segment. If so,
+  space for the copy relocation is reserved in .bss.rel.ro instead of
+  .bss. This fixes a security issue that read-only data in a DSO
+  becomes writable if it is copied by a copy relocation. This issue
+  was disclosed originally on the binutils mailing list at
+  `<https://sourceware.org/ml/libc-alpha/2016-12/msg00914.html>`.
+
+* Compressed input sections are supported.
+
+* ``--oformat binary``, ``--section-start``, ``-Tbss``, ``-Tdata``,
+  ``-Ttext``, ``-b binary``, ``-build-id=uuid``, ``-no-rosegment``,
+  ``-nopie``, ``-nostdlib``, ``-omagic``, ``-retain-symbols-file``,
+  ``-sort-section``, ``-z max-page-size`` and ``-z wxneeded`` are
+  suppoorted.
+
+* A lot of linker script directives have been added.
+
+* Default image base address for x86-64 has changed from 0x10000 to
+  0x200000 to make it huge-page friendly.
+
+* ARM port now supports GNU ifunc, the ARM C++ exceptions ABI, TLS
+  relocations and static linking. Problems with dlopen() on systems
+  using eglibc fixed.
+
+* MIPS port now supports input files in new R6 revision of MIPS ABIs
+  or N32 ABI. Generated file now contains .MIPS.abiflags section and
+  complete set of ELF headers flags.
+
+* Relocations produced by the ``-mxgot`` compiler's flag is supported
+  for MIPS. Now it is possible to generate "large" GOT exceeds 64K
+  limit.
 
 COFF Improvements
 -----------------
 
-* Item 1.
-
-MachO Improvements
-------------------
-
-* Item 1.
+* Performance on Windows has been improved by parallelizing parts of the
+  linker and optimizing file system operations. As a result of these
+  improvements, LLD 4.0 has been measured to be about 2.5 times faster
+  than LLD 3.9 when linking a large Chromium DLL.

Added: vendor/lld/dist/test/ELF/linkerscript/common-assign.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist/test/ELF/linkerscript/common-assign.s	Sun Jan 29 20:59:10 2017	(r312964)
@@ -0,0 +1,48 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: echo "SECTIONS { . = SIZEOF_HEADERS; pfoo = foo; pbar = bar; }" > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t
+# RUN: llvm-readobj -symbols %t1 | FileCheck %s
+
+# CHECK:       Symbol {
+# CHECK:         Name: bar
+# CHECK-NEXT:     Value: 0x134
+# CHECK-NEXT:     Size: 4
+# CHECK-NEXT:     Binding: Global
+# CHECK-NEXT:     Type: Object
+# CHECK-NEXT:     Other: 0
+# CHECK-NEXT:     Section: .bss
+# CHECK-NEXT:   }
+# CHECK-NEXT:   Symbol {
+# CHECK-NEXT:     Name: foo
+# CHECK-NEXT:     Value: 0x138
+# CHECK-NEXT:     Size: 4
+# CHECK-NEXT:     Binding: Global
+# CHECK-NEXT:     Type: Object
+# CHECK-NEXT:     Other: 0
+# CHECK-NEXT:     Section: .bss
+# CHECK-NEXT:   }
+# CHECK-NEXT:   Symbol {
+# CHECK-NEXT:     Name: pfoo
+# CHECK-NEXT:     Value: 0x138
+# CHECK-NEXT:     Size: 0
+# CHECK-NEXT:     Binding: Global
+# CHECK-NEXT:     Type: None
+# CHECK-NEXT:     Other: 0
+# CHECK-NEXT:     Section: .bss
+# CHECK-NEXT:   }
+# CHECK-NEXT:   Symbol {
+# CHECK-NEXT:     Name: pbar
+# CHECK-NEXT:     Value: 0x134
+# CHECK-NEXT:     Size: 0
+# CHECK-NEXT:     Binding: Global
+# CHECK-NEXT:     Type: None
+# CHECK-NEXT:     Other: 0
+# CHECK-NEXT:     Section: .bss
+# CHECK-NEXT:   }
+# CHECK-NEXT: ]
+
+.comm	foo,4,4
+.comm	bar,4,4
+movl	$1, foo(%rip)
+movl	$2, bar(%rip)



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