From owner-svn-src-vendor@freebsd.org Sat Sep 7 11:22:05 2019 Return-Path: Delivered-To: svn-src-vendor@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0050FEDCF4; Sat, 7 Sep 2019 11:22:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46QX7w5VBkz4Pvs; Sat, 7 Sep 2019 11:22:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 866F74D20; Sat, 7 Sep 2019 11:22:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x87BM4wV036172; Sat, 7 Sep 2019 11:22:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x87BM4bF036170; Sat, 7 Sep 2019 11:22:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909071122.x87BM4bF036170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 7 Sep 2019 11:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r351987 - in vendor/lld/dist-release_90: ELF docs X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist-release_90: ELF docs X-SVN-Commit-Revision: 351987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2019 11:22:05 -0000 Author: dim Date: Sat Sep 7 11:22:03 2019 New Revision: 351987 URL: https://svnweb.freebsd.org/changeset/base/351987 Log: Vendor import of lld release_90 branch r371301: https://llvm.org/svn/llvm-project/lld/branches/release_90@371301 Modified: vendor/lld/dist-release_90/ELF/Writer.cpp vendor/lld/dist-release_90/docs/ReleaseNotes.rst Modified: vendor/lld/dist-release_90/ELF/Writer.cpp ============================================================================== --- vendor/lld/dist-release_90/ELF/Writer.cpp Sat Sep 7 11:22:01 2019 (r351986) +++ vendor/lld/dist-release_90/ELF/Writer.cpp Sat Sep 7 11:22:03 2019 (r351987) @@ -2230,25 +2230,27 @@ template void Writer::fixSectionAli // same with its virtual address modulo the page size, so that the loader can // load executables without any address adjustment. static uint64_t computeFileOffset(OutputSection *os, uint64_t off) { - // File offsets are not significant for .bss sections. By convention, we keep - // section offsets monotonically increasing rather than setting to zero. - if (os->type == SHT_NOBITS) - return off; - - // If the section is not in a PT_LOAD, we just have to align it. - if (!os->ptLoad) - return alignTo(off, os->alignment); - // The first section in a PT_LOAD has to have congruent offset and address // module the page size. - OutputSection *first = os->ptLoad->firstSec; - if (os == first) { - uint64_t alignment = std::max(os->alignment, config->maxPageSize); + if (os->ptLoad && os->ptLoad->firstSec == os) { + uint64_t alignment = + std::max(os->ptLoad->p_align, config->maxPageSize); return alignTo(off, alignment, os->addr); } + // File offsets are not significant for .bss sections other than the first one + // in a PT_LOAD. By convention, we keep section offsets monotonically + // increasing rather than setting to zero. + if (os->type == SHT_NOBITS) + return off; + + // If the section is not in a PT_LOAD, we just have to align it. + if (!os->ptLoad) + return alignTo(off, os->alignment); + // If two sections share the same PT_LOAD the file offset is calculated // using this formula: Off2 = Off1 + (VA2 - VA1). + OutputSection *first = os->ptLoad->firstSec; return first->offset + os->addr - first->addr; } Modified: vendor/lld/dist-release_90/docs/ReleaseNotes.rst ============================================================================== --- vendor/lld/dist-release_90/docs/ReleaseNotes.rst Sat Sep 7 11:22:01 2019 (r351986) +++ vendor/lld/dist-release_90/docs/ReleaseNotes.rst Sat Sep 7 11:22:03 2019 (r351987) @@ -8,11 +8,13 @@ lld 9.0.0 Release Notes Introduction ============ -This document contains the release notes for the lld linker, release 9.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 `_. +lld is a high-performance linker that supports ELF (Unix), COFF +(Windows), Mach-O (macOS), MinGW and WebAssembly. lld is +command-line-compatible with GNU linkers and Microsoft link.exe and is +significantly faster than the system default linkers. +lld 9 has lots of feature improvements and bug fixes. + Non-comprehensive list of changes in this release ================================================= @@ -22,53 +24,188 @@ ELF Improvements * ld.lld now has typo suggestions for flags: ``$ ld.lld --call-shared`` now prints ``unknown argument '--call-shared', did you mean '--call_shared'``. + (`r361518 `_) +* ``--allow-shlib-undefined`` and ``--no-allow-shlib-undefined`` + options are added. ``--no-allow-shlib-undefined`` is the default for + executables. + (`r352826 `_) + +* ``-nmagic`` and ``-omagic`` options are fully supported. + (`r360593 `_) + +* Segment layout has changed. PT_GNU_RELRO, which was previously + placed in the middle of readable/writable PT_LOAD segments, is now + placed at the beginning of them. This change permits lld-produced + ELF files to be read correctly by GNU strip older than 2.31, which + has a bug to discard a PT_GNU_RELRO in the former layout. + +* ``-z common-page-size`` is supported. + (`r360593 `_) + +* Diagnostics messages have improved. A new flag ``--vs-diagnostics`` + alters the format of diagnostic output to enable source hyperlinks + in Microsoft Visual Studio IDE. + +* Linker script compatibility with GNU BFD linker has generally improved. + +* The clang ``--dependent-library`` form of autolinking is supported. + + This feature is added to implement the Windows-style autolinking for + Unix. On Unix, in order to use a library, you usually have to + include a header file provided by the library and then explicitly + link the library with the linker ``-l`` option. On Windows, header + files usually contain pragmas that list needed libraries. Compilers + copy that information to object files, so that linkers can + automatically link needed libraries. ``--dependent-library`` is + added for implementing that Windows semantics on Unix. + (`r360984 `_) + +* AArch64 BTI and PAC are supported. + (`r362793 `_) + * lld now supports replacing ``JAL`` with ``JALX`` instructions in case - of MIPS - microMIPS cross-mode jumps. + of MIPS-microMIPS cross-mode jumps. + (`r354311 `_) * lld now creates LA25 thunks for MIPS R6 code. + (`r354312 `_) * Put MIPS-specific .reginfo, .MIPS.options, and .MIPS.abiflags sections into corresponding PT_MIPS_REGINFO, PT_MIPS_OPTIONS, and PT_MIPS_ABIFLAGS segments. +* The quality of RISC-V and PowerPC ports have greatly improved. Many + applications can now be linked by lld. PowerPC64 is now almost + production ready. + +* The Linux kernel for arm32_7, arm64, ppc64le and x86_64 can now be + linked by lld. + +* x86-64 TLSDESC is supported. + (`r361911 `_, + `r362078 `_) + +* DF_STATIC_TLS flag is set for i386 and x86-64 when needed. + (`r353293 `_, + `r353378 `_) + +* The experimental partitioning feature is added to allow a program to + be split into multiple pieces. + + The feature allows you to semi-automatically split a single program + into multiple ELF files called "partitions". Since all partitions + share the same memory address space and don't use PLT/GOT, split + programs run as fast as regular programs. + + With the mechanism, you can start a program only with a "main" + partition and load remaining partitions on-demand. For example, you + can split a web browser into a main partition and a PDF reader + sub-partition and load the PDF reader partition only when a user + tries to open a PDF file. + + See `the documentation `_ for more information. + +* If "-" is given as an output filename, lld writes the final result + to the standard output. Previously, it created a file "-" in the + current directory. + (`r351852 `_) + +* ``-z ifunc-noplt`` option is added to reduce IFunc function call + overhead in a freestanding environment such as the OS kernel. + + Functions resolved by the IFunc mechanism are usually dispatched via + PLT and thus slower than regular functions because of the cost of + indirection. With ``-z ifunc-noplt``, you can eliminate it by doing + text relocations at load-time. You need a special loader to utilize + this feature. This feature is added for the FreeBSD kernel but can + be used by any operating systems. + (`r360685 `_) + +* ``--undefined-glob`` option is added. The new option is an extension + to ``--undefined`` to take a glob pattern instead of a single symbol + name. + (`r363396 `_) + + COFF Improvements ----------------- * Like the ELF driver, lld-link now has typo suggestions for flags. + (`r361518 `_) -* lld-link now correctly reports duplicate symbol errors for obj files - that were compiled with /Gy. +* lld-link now correctly reports duplicate symbol errors for object + files that were compiled with ``/Gy``. + (`r352590 `_) -* lld-link now correctly reports duplicate symbol errors when several res - input files define resources with the same type, name, and language. - This can be demoted to a warning using ``/force:multipleres``. +* lld-link now correctly reports duplicate symbol errors when several + resource (.res) input files define resources with the same type, + name and language. This can be demoted to a warning using + ``/force:multipleres``. + (`r359829 `_) -* lld-link now rejects more than one resource obj input files, matching - link.exe. Previously, lld-link would silently ignore all but one. - If you hit this: Don't pass resource obj files to the linker, instead pass - res files to the linker directly. Don't put res files in static libraries, - pass them on the command line. +* lld-link now rejects more than one resource object input files, + matching link.exe. Previously, lld-link would silently ignore all + but one. If you hit this: Don't pass resource object files to the + linker, instead pass res files to the linker directly. Don't put + resource files in static libraries, pass them on the command line. + (`r359749 `_) * Having more than two ``/natvis:`` now works correctly; it used to not work for larger binaries before. + (`r327895 `_) * Undefined symbols are now printed only in demangled form. Pass ``/demangle:no`` to see raw symbol names instead. + (`r355878 `_) -* The following flags have been added: ``/functionpadmin``, ``/swaprun:``, - ``/threads:no`` - * Several speed and memory usage improvements. -* Range extension thunks are now created for ARM64, if needed - * lld-link now supports resource object files created by GNU windres and - MS cvtres, not only llvm-cvtres + MS cvtres, not only llvm-cvtres. * The generated thunks for delayimports now share the majority of code - among thunks, significantly reducing the overhead of using delayimport + among thunks, significantly reducing the overhead of using delayimport. + (`r365823 `_) +* ``IMAGE_REL_ARM{,64}_REL32`` relocations are supported. + (`r352325 `_) + +* Range extension thunks for AArch64 are now supported, so lld can + create large executables for Windows/ARM64. + (`r352929 `_) + +* The following flags have been added: + ``/functionpadmin`` (`r354716 `_), + ``/swaprun:`` (`r359192 `_), + ``/threads:no`` (`r355029 `_), + ``/filealign`` (`r361634 `_) + +WebAssembly Improvements +------------------------ + +* Imports from custom module names are supported. + (`r352828 `_) + +* Symbols that are in llvm.used are now exported by default. + (`r353364 `_) + +* Initial support for PIC and dynamic linking has landed. + (`r357022 `_) + +* wasm-ld now add ``__start_``/``__stop_`` symbols for data sections. + (`r361236 `_) + +* wasm-ld now doesn't report an error on archives without a symbol index. + (`r364338 `_) + +* The following flags have been added: + ``--emit-relocs`` (`r361635 `_), + ``--wrap`` (`r361639 `_), + ``--trace`` and ``--trace-symbol`` + (`r353264 `_). + + MinGW Improvements ------------------ @@ -77,12 +214,18 @@ MinGW Improvements DWARF exception handling with libgcc and gcc's crtend.o. * lld now also handles DWARF unwind info generated by GCC, when linking - with libgcc + with libgcc. -* Many more GNU ld options are now supported, which e.g. allows the lld - MinGW frontend to be called by GCC - * PDB output can be requested without manually specifying the PDB file name, with the new option ``-pdb=`` with an empty value to the option. (The old existing syntax ``-pdb `` was more cumbersome to use with an empty parameter value.) + +* ``--no-insert-timestamp`` option is added as an alias to ``/timestamp:0``. + (`r353145 `_) + +* Many more GNU ld options are now supported, which e.g. allows the lld + MinGW frontend to be called by GCC. + +* The following options are added: ``--exclude-all-symbols``, + ``--appcontainer``, ``--undefined``