From owner-svn-src-all@freebsd.org Sun Nov 4 14:42:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C7C710D8DA3; Sun, 4 Nov 2018 14:42:31 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A203974048; Sun, 4 Nov 2018 14:42:29 +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 86DD11CC6; Sun, 4 Nov 2018 14:42:23 +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 wA4EgNqo062100; Sun, 4 Nov 2018 14:42:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA4EgLxj062090; Sun, 4 Nov 2018 14:42:21 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201811041442.wA4EgLxj062090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Nov 2018 14:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r340122 - in vendor/lld/dist-release_70: COFF ELF test/COFF test/ELF test/ELF/linkerscript X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist-release_70: COFF ELF test/COFF test/ELF test/ELF/linkerscript X-SVN-Commit-Revision: 340122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A203974048 X-Spamd-Result: default: False [-0.89 / 200.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.78)[-0.781,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2018 14:42:31 -0000 Author: dim Date: Sun Nov 4 14:42:21 2018 New Revision: 340122 URL: https://svnweb.freebsd.org/changeset/base/340122 Log: Vendor import of lld release_70 branch r346007: https://llvm.org/svn/llvm-project/lld/branches/release_70@346007 Added: vendor/lld/dist-release_70/test/COFF/arm64-localimport-align.s (contents, props changed) vendor/lld/dist-release_70/test/ELF/linkerscript/memory-include.test vendor/lld/dist-release_70/test/ELF/linkerscript/output-section-include.test vendor/lld/dist-release_70/test/ELF/linkerscript/section-include.test vendor/lld/dist-release_70/test/ELF/local-ver-preemptible.s (contents, props changed) vendor/lld/dist-release_70/test/ELF/relocatable-rel-iplt.s (contents, props changed) Modified: vendor/lld/dist-release_70/COFF/Chunks.h vendor/lld/dist-release_70/ELF/ScriptParser.cpp vendor/lld/dist-release_70/ELF/Symbols.cpp vendor/lld/dist-release_70/ELF/Writer.cpp Modified: vendor/lld/dist-release_70/COFF/Chunks.h ============================================================================== --- vendor/lld/dist-release_70/COFF/Chunks.h Sun Nov 4 14:42:17 2018 (r340121) +++ vendor/lld/dist-release_70/COFF/Chunks.h Sun Nov 4 14:42:21 2018 (r340122) @@ -345,7 +345,9 @@ class ImportThunkChunkARM64 : public Chunk { (private) // See comments for DefinedLocalImport class. class LocalImportChunk : public Chunk { public: - explicit LocalImportChunk(Defined *S) : Sym(S) {} + explicit LocalImportChunk(Defined *S) : Sym(S) { + Alignment = Config->is64() ? 8 : 4; + } size_t getSize() const override; void getBaserels(std::vector *Res) override; void writeTo(uint8_t *Buf) const override; Modified: vendor/lld/dist-release_70/ELF/ScriptParser.cpp ============================================================================== --- vendor/lld/dist-release_70/ELF/ScriptParser.cpp Sun Nov 4 14:42:17 2018 (r340121) +++ vendor/lld/dist-release_70/ELF/ScriptParser.cpp Sun Nov 4 14:42:21 2018 (r340122) @@ -497,6 +497,9 @@ void ScriptParser::readSections() { for (BaseCommand *Cmd : readOverlay()) V.push_back(Cmd); continue; + } else if (Tok == "INCLUDE") { + readInclude(); + continue; } if (BaseCommand *Cmd = readAssignment(Tok)) @@ -778,6 +781,8 @@ OutputSection *ScriptParser::readOutputSectionDescript Cmd->Filler = readFill(); } else if (Tok == "SORT") { readSort(); + } else if (Tok == "INCLUDE") { + readInclude(); } else if (peek() == "(") { Cmd->SectionCommands.push_back(readInputSectionDescription(Tok)); } else { @@ -1404,7 +1409,11 @@ uint64_t ScriptParser::readMemoryAssignment(StringRef void ScriptParser::readMemory() { expect("{"); while (!errorCount() && !consume("}")) { - StringRef Name = next(); + StringRef Tok = next(); + if (Tok == "INCLUDE") { + readInclude(); + continue; + } uint32_t Flags = 0; uint32_t NegFlags = 0; @@ -1419,10 +1428,9 @@ void ScriptParser::readMemory() { uint64_t Length = readMemoryAssignment("LENGTH", "len", "l"); // Add the memory region to the region map. - MemoryRegion *MR = - make(Name, Origin, Length, Flags, NegFlags); - if (!Script->MemoryRegions.insert({Name, MR}).second) - setError("region '" + Name + "' already defined"); + MemoryRegion *MR = make(Tok, Origin, Length, Flags, NegFlags); + if (!Script->MemoryRegions.insert({Tok, MR}).second) + setError("region '" + Tok + "' already defined"); } } Modified: vendor/lld/dist-release_70/ELF/Symbols.cpp ============================================================================== --- vendor/lld/dist-release_70/ELF/Symbols.cpp Sun Nov 4 14:42:17 2018 (r340121) +++ vendor/lld/dist-release_70/ELF/Symbols.cpp Sun Nov 4 14:42:21 2018 (r340122) @@ -209,7 +209,7 @@ uint8_t Symbol::computeBinding() const { return Binding; if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED) return STB_LOCAL; - if (VersionId == VER_NDX_LOCAL && isDefined()) + if (VersionId == VER_NDX_LOCAL && isDefined() && !IsPreemptible) return STB_LOCAL; if (!Config->GnuUnique && Binding == STB_GNU_UNIQUE) return STB_GLOBAL; Modified: vendor/lld/dist-release_70/ELF/Writer.cpp ============================================================================== --- vendor/lld/dist-release_70/ELF/Writer.cpp Sun Nov 4 14:42:17 2018 (r340121) +++ vendor/lld/dist-release_70/ELF/Writer.cpp Sun Nov 4 14:42:21 2018 (r340122) @@ -874,7 +874,7 @@ void PhdrEntry::add(OutputSection *Sec) { // need these symbols, since IRELATIVE relocs are resolved through GOT // and PLT. For details, see http://www.airs.com/blog/archives/403. template void Writer::addRelIpltSymbols() { - if (needsInterpSection()) + if (Config->Relocatable || needsInterpSection()) return; StringRef S = Config->IsRela ? "__rela_iplt_start" : "__rel_iplt_start"; addOptionalRegular(S, InX::RelaIplt, 0, STV_HIDDEN, STB_WEAK); Added: vendor/lld/dist-release_70/test/COFF/arm64-localimport-align.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_70/test/COFF/arm64-localimport-align.s Sun Nov 4 14:42:21 2018 (r340122) @@ -0,0 +1,24 @@ +// REQUIRES: aarch64 +// RUN: llvm-mc -filetype=obj -triple=aarch64-windows %s -o %t.obj +// RUN: lld-link -entry:main -subsystem:console %t.obj -out:%t.exe +// Don't check the output, just make sure it links fine and doesn't +// error out due to a misaligned load. + .text + .globl main + .globl myfunc +main: + adrp x8, __imp_myfunc + ldr x0, [x8, :lo12:__imp_myfunc] + br x0 + ret +myfunc: + ret + + .section .rdata, "dr" + // Start the .rdata section with a 4 byte chunk, to expose the alignment + // of the next chunk in the section. +mydata: + .byte 42 + // The synthesized LocalImportChunk gets stored here in the .rdata + // section, but needs to get proper 8 byte alignment since it is a + // pointer, just like regular LookupChunks in the IAT. Added: vendor/lld/dist-release_70/test/ELF/linkerscript/memory-include.test ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_70/test/ELF/linkerscript/memory-include.test Sun Nov 4 14:42:21 2018 (r340122) @@ -0,0 +1,23 @@ +# REQUIRES: x86 + +# RUN: echo '.section .text,"ax"; .global _start; nop' > %t.s +# RUN: echo '.section .data,"aw"; .quad 0' >> %t.s +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o + +# RUN: echo "RAM2 (rwx): ORIGIN = 0x3000, LENGTH = 0x100" > %t.inc +# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s +# CHECK: .data 00000008 0000000000002000 DATA +# CHECK: .data2 00000008 0000000000003000 DATA + +MEMORY { + ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100 + RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100 + INCLUDE "memory-include.test.tmp.inc" +} + +SECTIONS { + .text : { *(.text*) } > ROM + .data : { *(.data*) } > RAM + .data2 : { QUAD(0) } > RAM2 +} Added: vendor/lld/dist-release_70/test/ELF/linkerscript/output-section-include.test ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_70/test/ELF/linkerscript/output-section-include.test Sun Nov 4 14:42:21 2018 (r340122) @@ -0,0 +1,30 @@ +# REQUIRES: x86 + +# RUN: echo '.section .text,"ax"; .global _start; nop' > %t.s +# RUN: echo '.section .data,"aw"; .quad 0' >> %t.s +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o + +## Empty include file. +# RUN: echo "" > %t.inc +# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK1 +# CHECK1: .data 00000008 0000000000002000 DATA + +## Non-empty include file. +# RUN: echo "QUAD(0)" > %t.inc +# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK2 +# CHECK2: .data 00000010 0000000000002000 DATA + +MEMORY { + ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100 + RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100 +} + +SECTIONS { + .text : { *(.text*) } > ROM + .data : { + *(.data*) + INCLUDE "output-section-include.test.tmp.inc" + } > RAM +} Added: vendor/lld/dist-release_70/test/ELF/linkerscript/section-include.test ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_70/test/ELF/linkerscript/section-include.test Sun Nov 4 14:42:21 2018 (r340122) @@ -0,0 +1,32 @@ +# REQUIRES: x86 + +# RUN: echo '.section .text,"ax"; .global _start; nop' > %t.s +# RUN: echo '.section .data,"aw"; .quad 0' >> %t.s +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o + +## Empty include file. +# RUN: echo "" > %t.inc +# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK1 +# CHECK1: .data 00000008 0000000000002000 DATA +# CHECK1-NEXT: .data3 00000008 0000000000002008 DATA + +## Non-empty include file. +# RUN: echo ".data2 : { QUAD(0) } > RAM" > %t.inc +# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK2 +# CHECK2: .data 00000008 0000000000002000 DATA +# CHECK2-NEXT: .data2 00000008 0000000000002008 DATA +# CHECK2-NEXT: .data3 00000008 0000000000002010 DATA + +MEMORY { + ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100 + RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100 +} + +SECTIONS { + .text : { *(.text*) } > ROM + .data : { *(.data*) } > RAM + INCLUDE "section-include.test.tmp.inc" + .data3 : { QUAD(0) } > RAM +} Added: vendor/lld/dist-release_70/test/ELF/local-ver-preemptible.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_70/test/ELF/local-ver-preemptible.s Sun Nov 4 14:42:21 2018 (r340122) @@ -0,0 +1,22 @@ +# REQUIRES: x86 +# RUN: echo '.global foo; .type foo, @function; foo:' | \ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t.so.o +# RUN: ld.lld %t.so.o -o %t.so -shared + +# RUN: echo "{ global: main; local: *; };" > %t.script + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o %t.so -o %t -version-script %t.script +# RUN: llvm-readelf -r --symbols %t | FileCheck %s + +# CHECK: Relocation section '.rela.plt' at offset {{.*}} contains 1 entries: +# CHECK: R_X86_64_JUMP_SLOT 0000000000201020 foo + 0 + +# CHECK: Symbol table '.dynsym' contains 2 entries: +# CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name +# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND @ +# CHECK-NEXT: 1: 0000000000201020 0 FUNC GLOBAL DEFAULT UND foo@ + +.globl _start +_start: + movl $foo - ., %eax Added: vendor/lld/dist-release_70/test/ELF/relocatable-rel-iplt.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_70/test/ELF/relocatable-rel-iplt.s Sun Nov 4 14:42:21 2018 (r340122) @@ -0,0 +1,56 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=i686-- %s -o %t1.o +# RUN: ld.lld -r %t1.o -o %t2.o +# RUN: llvm-readobj -t %t2.o | FileCheck %s + +// CHECK: Symbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Section (0x3) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text (0x1) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: __rel_iplt_end (1) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Weak (0x2) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN (0x2) +// CHECK-NEXT: ] +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: __rel_iplt_start (16) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Weak (0x2) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other [ (0x2) +// CHECK-NEXT: STV_HIDDEN (0x2) +// CHECK-NEXT: ] +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: ] + + movl __rel_iplt_start, %eax + movl __rel_iplt_end, %eax + ret + + .hidden __rel_iplt_start + .hidden __rel_iplt_end + .weak __rel_iplt_start + .weak __rel_iplt_end