Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2018 20:26:03 +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: r328370 - in vendor/lld/dist-release_60: COFF ELF test/ELF test/ELF/Inputs test/ELF/linkerscript
Message-ID:  <201801242026.w0OKQ3G1043107@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Jan 24 20:26:03 2018
New Revision: 328370
URL: https://svnweb.freebsd.org/changeset/base/328370

Log:
  Vendor import of lld release_60 branch r323338:
  https://llvm.org/svn/llvm-project/lld/branches/release_60@323338

Added:
  vendor/lld/dist-release_60/test/ELF/Inputs/as-needed-lazy.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/Inputs/compress-debug.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/as-needed-lazy.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/compress-debug-sections-reloc.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/linkerscript/at-self-reference.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/linkerscript/at2.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/linkerscript/compress-debug-sections-custom.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/linkerscript/parse-section-in-addr.s   (contents, props changed)
  vendor/lld/dist-release_60/test/ELF/sysv-hash-no-rosegment.s   (contents, props changed)
Modified:
  vendor/lld/dist-release_60/COFF/Driver.cpp
  vendor/lld/dist-release_60/ELF/LinkerScript.cpp
  vendor/lld/dist-release_60/ELF/OutputSections.cpp
  vendor/lld/dist-release_60/ELF/OutputSections.h
  vendor/lld/dist-release_60/ELF/ScriptParser.cpp
  vendor/lld/dist-release_60/ELF/SymbolTable.cpp
  vendor/lld/dist-release_60/ELF/SyntheticSections.cpp
  vendor/lld/dist-release_60/ELF/Writer.cpp

Modified: vendor/lld/dist-release_60/COFF/Driver.cpp
==============================================================================
--- vendor/lld/dist-release_60/COFF/Driver.cpp	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/COFF/Driver.cpp	Wed Jan 24 20:26:03 2018	(r328370)
@@ -57,6 +57,7 @@ bool link(ArrayRef<const char *> Args, bool CanExitEar
   errorHandler().ErrorLimitExceededMsg =
       "too many errors emitted, stopping now"
       " (use /ERRORLIMIT:0 to see all errors)";
+  errorHandler().ExitEarly = CanExitEarly;
   Config = make<Configuration>();
   Config->Argv = {Args.begin(), Args.end()};
   Config->CanExitEarly = CanExitEarly;

Modified: vendor/lld/dist-release_60/ELF/LinkerScript.cpp
==============================================================================
--- vendor/lld/dist-release_60/ELF/LinkerScript.cpp	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/ELF/LinkerScript.cpp	Wed Jan 24 20:26:03 2018	(r328370)
@@ -608,13 +608,6 @@ void LinkerScript::switchTo(OutputSection *Sec) {
 
   Ctx->OutSec = Sec;
   Ctx->OutSec->Addr = advance(0, Ctx->OutSec->Alignment);
-
-  // If neither AT nor AT> is specified for an allocatable section, the linker
-  // will set the LMA such that the difference between VMA and LMA for the
-  // section is the same as the preceding output section in the same region
-  // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html
-  if (Ctx->LMAOffset)
-    Ctx->OutSec->LMAOffset = Ctx->LMAOffset();
 }
 
 // This function searches for a memory region to place the given output
@@ -662,17 +655,28 @@ void LinkerScript::assignOffsets(OutputSection *Sec) {
   if (Ctx->MemRegion)
     Dot = Ctx->MemRegionOffset[Ctx->MemRegion];
 
+  switchTo(Sec);
+
   if (Sec->LMAExpr) {
     uint64_t D = Dot;
     Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; };
   }
 
-  switchTo(Sec);
+  if (!Sec->LMARegionName.empty()) {
+    if (MemoryRegion *MR = MemoryRegions.lookup(Sec->LMARegionName)) {
+      uint64_t Offset = MR->Origin - Dot;
+      Ctx->LMAOffset = [=] { return Offset; };
+    } else {
+      error("memory region '" + Sec->LMARegionName + "' not declared");
+    }
+  }
 
-  // We do not support custom layout for compressed debug sectons.
-  // At this point we already know their size and have compressed content.
-  if (Ctx->OutSec->Flags & SHF_COMPRESSED)
-    return;
+  // If neither AT nor AT> is specified for an allocatable section, the linker
+  // will set the LMA such that the difference between VMA and LMA for the
+  // section is the same as the preceding output section in the same region
+  // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html
+  if (Ctx->LMAOffset)
+    Ctx->OutSec->LMAOffset = Ctx->LMAOffset();
 
   // The Size previously denoted how many InputSections had been added to this
   // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to

Modified: vendor/lld/dist-release_60/ELF/OutputSections.cpp
==============================================================================
--- vendor/lld/dist-release_60/ELF/OutputSections.cpp	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/ELF/OutputSections.cpp	Wed Jan 24 20:26:03 2018	(r328370)
@@ -183,15 +183,6 @@ template <class ELFT> void OutputSection::maybeCompres
       !Name.startswith(".debug_"))
     return;
 
-  // Calculate the section offsets and size pre-compression.
-  Size = 0;
-  for (BaseCommand *Cmd : SectionCommands)
-    if (auto *ISD = dyn_cast<InputSectionDescription>(Cmd))
-      for (InputSection *IS : ISD->Sections) {
-        IS->OutSecOff = alignTo(Size, IS->Alignment);
-        this->Size = IS->OutSecOff + IS->getSize();
-      }
-
   // Create a section header.
   ZDebugHeader.resize(sizeof(Elf_Chdr));
   auto *Hdr = reinterpret_cast<Elf_Chdr *>(ZDebugHeader.data());

Modified: vendor/lld/dist-release_60/ELF/OutputSections.h
==============================================================================
--- vendor/lld/dist-release_60/ELF/OutputSections.h	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/ELF/OutputSections.h	Wed Jan 24 20:26:03 2018	(r328370)
@@ -99,6 +99,7 @@ class OutputSection final : public BaseCommand, public
   ConstraintKind Constraint = ConstraintKind::NoConstraint;
   std::string Location;
   std::string MemoryRegionName;
+  std::string LMARegionName;
   bool Noload = false;
 
   template <class ELFT> void finalize();

Modified: vendor/lld/dist-release_60/ELF/ScriptParser.cpp
==============================================================================
--- vendor/lld/dist-release_60/ELF/ScriptParser.cpp	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/ELF/ScriptParser.cpp	Wed Jan 24 20:26:03 2018	(r328370)
@@ -709,6 +709,14 @@ OutputSection *ScriptParser::readOutputSectionDescript
   if (consume(">"))
     Cmd->MemoryRegionName = next();
 
+  if (consume("AT")) {
+    expect(">");
+    Cmd->LMARegionName = next();
+  }
+
+  if (Cmd->LMAExpr && !Cmd->LMARegionName.empty())
+    error("section can't have both LMA and a load region");
+
   Cmd->Phdrs = readOutputSectionPhdrs();
 
   if (consume("="))
@@ -922,7 +930,10 @@ ByteCommand *ScriptParser::readByteCommand(StringRef T
 
 StringRef ScriptParser::readParenLiteral() {
   expect("(");
+  bool Orig = InExpr;
+  InExpr = false;
   StringRef Tok = next();
+  InExpr = Orig;
   expect(")");
   return Tok;
 }

Modified: vendor/lld/dist-release_60/ELF/SymbolTable.cpp
==============================================================================
--- vendor/lld/dist-release_60/ELF/SymbolTable.cpp	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/ELF/SymbolTable.cpp	Wed Jan 24 20:26:03 2018	(r328370)
@@ -491,12 +491,13 @@ void SymbolTable::addShared(StringRef Name, SharedFile
   if (WasInserted || ((S->isUndefined() || S->isLazy()) &&
                       S->getVisibility() == STV_DEFAULT)) {
     uint8_t Binding = S->Binding;
+    bool WasUndefined = S->isUndefined();
     replaceSymbol<SharedSymbol>(S, File, Name, Sym.getBinding(), Sym.st_other,
                                 Sym.getType(), Sym.st_value, Sym.st_size,
                                 Alignment, VerdefIndex);
     if (!WasInserted) {
       S->Binding = Binding;
-      if (!S->isWeak() && !Config->GcSections)
+      if (!S->isWeak() && !Config->GcSections && WasUndefined)
         File.IsNeeded = true;
     }
   }

Modified: vendor/lld/dist-release_60/ELF/SyntheticSections.cpp
==============================================================================
--- vendor/lld/dist-release_60/ELF/SyntheticSections.cpp	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/ELF/SyntheticSections.cpp	Wed Jan 24 20:26:03 2018	(r328370)
@@ -1823,6 +1823,9 @@ void HashTableSection::finalizeContents() {
 }
 
 void HashTableSection::writeTo(uint8_t *Buf) {
+  // See comment in GnuHashTableSection::writeTo.
+  memset(Buf, 0, Size);
+
   unsigned NumSymbols = InX::DynSymTab->getNumSymbols();
 
   uint32_t *P = reinterpret_cast<uint32_t *>(Buf);
@@ -2435,10 +2438,8 @@ void MergeNoTailSection::finalizeContents() {
   parallelForEachN(0, Concurrency, [&](size_t ThreadId) {
     for (MergeInputSection *Sec : Sections) {
       for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I) {
-        if (!Sec->Pieces[I].Live)
-          continue;
         size_t ShardId = getShardId(Sec->Pieces[I].Hash);
-        if ((ShardId & (Concurrency - 1)) == ThreadId)
+        if ((ShardId & (Concurrency - 1)) == ThreadId && Sec->Pieces[I].Live)
           Sec->Pieces[I].OutputOff = Shards[ShardId].add(Sec->getData(I));
       }
     }

Modified: vendor/lld/dist-release_60/ELF/Writer.cpp
==============================================================================
--- vendor/lld/dist-release_60/ELF/Writer.cpp	Wed Jan 24 20:25:59 2018	(r328369)
+++ vendor/lld/dist-release_60/ELF/Writer.cpp	Wed Jan 24 20:26:03 2018	(r328370)
@@ -427,13 +427,14 @@ template <class ELFT> void Writer<ELFT>::run() {
   if (errorCount())
     return;
 
+  Script->assignAddresses();
+
   // If -compressed-debug-sections is specified, we need to compress
   // .debug_* sections. Do it right now because it changes the size of
   // output sections.
-  parallelForEach(OutputSections,
-                  [](OutputSection *Sec) { Sec->maybeCompress<ELFT>(); });
+  for (OutputSection *Sec : OutputSections)
+    Sec->maybeCompress<ELFT>();
 
-  Script->assignAddresses();
   Script->allocateHeaders(Phdrs);
 
   // Remove empty PT_LOAD to avoid causing the dynamic linker to try to mmap a

Added: vendor/lld/dist-release_60/test/ELF/Inputs/as-needed-lazy.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/Inputs/as-needed-lazy.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,3 @@
+.global foo
+foo:
+  nop

Added: vendor/lld/dist-release_60/test/ELF/Inputs/compress-debug.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/Inputs/compress-debug.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,5 @@
+.text
+.fill 0x44
+
+.section .debug_info,"",@progbits
+.fill 0x43

Added: vendor/lld/dist-release_60/test/ELF/as-needed-lazy.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/as-needed-lazy.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,14 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/as-needed-lazy.s -o %t2.o
+# RUN: ld.lld %t2.o -o %t2.so -shared
+# RUN: rm -f %t2.a
+# RUN: llvm-ar rc %t2.a %t2.o
+# RUN: ld.lld %t1.o %t2.a --as-needed %t2.so -o %t
+# RUN: llvm-readobj -d %t | FileCheck %s
+
+# CHECK-NOT: NEEDED
+
+.global _start
+_start:
+  nop

Added: vendor/lld/dist-release_60/test/ELF/compress-debug-sections-reloc.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/compress-debug-sections-reloc.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,26 @@
+# REQUIRES: x86, zlib
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/compress-debug.s -o %t2.o
+# RUN: ld.lld %t2.o %t.o -o %t1 --compress-debug-sections=zlib -Ttext=0
+# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s
+# These two checks correspond to the patched values of a_sym and a_debug_sym.
+# D = 0x44 - address of .text input section for this file (the start address of
+#     .text is 0 as requested on the command line, and the size of the
+#	  preceding .text in the other input file is 0x44).
+# C = 0x43 - offset of .debug_info section for this file (the size of
+#     the preceding .debug_info from the other input file is 0x43).
+# CHECK: 0x00000000: "D"
+# CHECK: 0x00000004: "C"
+
+.text
+a_sym:
+nop
+
+.section .debug_str,"",@progbits
+.long a_sym
+.long a_debug_sym
+
+.section .debug_info,"",@progbits
+a_debug_sym:
+.long 0x88776655

Added: vendor/lld/dist-release_60/test/ELF/linkerscript/at-self-reference.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/linkerscript/at-self-reference.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,63 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: echo "SECTIONS { \
+# RUN:  . = 0x1000; \
+# RUN:  .aaa : AT(ADDR(.aaa)) { *(.aaa) } \
+# RUN:  .bbb : AT(ADDR(.bbb)) { *(.bbb) } \
+# RUN: }" > %t.script
+# RUN: ld.lld %t --script %t.script -o %t2
+# RUN: llvm-readobj -program-headers %t2 | FileCheck %s
+
+# CHECK:      ProgramHeaders [
+# CHECK-NEXT:  ProgramHeader {
+# CHECK-NEXT:    Type: PT_LOAD (0x1)
+# CHECK-NEXT:    Offset: 0x1000
+# CHECK-NEXT:    VirtualAddress: 0x1000
+# CHECK-NEXT:    PhysicalAddress: 0x1000
+# CHECK-NEXT:    FileSize: 3
+# CHECK-NEXT:    MemSize: 3
+# CHECK-NEXT:    Flags [ (0x5)
+# CHECK-NEXT:      PF_R (0x4)
+# CHECK-NEXT:      PF_X (0x1)
+# CHECK-NEXT:    ]
+# CHECK-NEXT:    Alignment: 4096
+# CHECK-NEXT:  }
+# CHECK-NEXT:  ProgramHeader {
+# CHECK-NEXT:    Type: PT_LOAD (0x1)
+# CHECK-NEXT:    Offset: 0x1008
+# CHECK-NEXT:    VirtualAddress: 0x1008
+# CHECK-NEXT:    PhysicalAddress: 0x1008
+# CHECK-NEXT:    FileSize: 9
+# CHECK-NEXT:    MemSize: 9
+# CHECK-NEXT:    Flags [ (0x5)
+# CHECK-NEXT:      PF_R (0x4)
+# CHECK-NEXT:      PF_X (0x1)
+# CHECK-NEXT:    ]
+# CHECK-NEXT:    Alignment: 4096
+# CHECK-NEXT:  }
+# CHECK-NEXT:  ProgramHeader {
+# CHECK-NEXT:    Type: PT_GNU_STACK (0x6474E551)
+# CHECK-NEXT:    Offset: 0x0
+# CHECK-NEXT:    VirtualAddress: 0x0
+# CHECK-NEXT:    PhysicalAddress: 0x0
+# CHECK-NEXT:    FileSize: 0
+# CHECK-NEXT:    MemSize: 0
+# CHECK-NEXT:    Flags [ (0x6)
+# CHECK-NEXT:      PF_R (0x4)
+# CHECK-NEXT:      PF_W (0x2)
+# CHECK-NEXT:    ]
+# CHECK-NEXT:    Alignment: 0
+# CHECK-NEXT:  }
+# CHECK-NEXT:]
+
+.global _start
+_start:
+ nop
+
+
+.section .aaa, "a"
+.asciz "aa"
+
+.section .bbb, "a"
+.align 8
+.quad 0

Added: vendor/lld/dist-release_60/test/ELF/linkerscript/at2.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/linkerscript/at2.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,81 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: echo "MEMORY {                                   \
+# RUN:   AX (ax)   : ORIGIN = 0x2000, LENGTH = 0x100   \
+# RUN:   AW (aw)   : ORIGIN = 0x3000, LENGTH = 0x100   \
+# RUN:   FLASH (ax) : ORIGIN = 0x6000, LENGTH = 0x100   \
+# RUN:   RAM (aw)   : ORIGIN = 0x7000, LENGTH = 0x100 } \
+# RUN: SECTIONS {                                       \
+# RUN:  .foo1 : { *(.foo1) } > AX AT>FLASH             \
+# RUN:  .foo2 : { *(.foo2) } > AX                      \
+# RUN:  .bar1 : { *(.bar1) } > AW AT> RAM              \
+# RUN:  .bar2 : { *(.bar2) } > AW AT > RAM             \
+# RUN:  .bar3 : { *(.bar3) } > AW AT >RAM              \
+# RUN: }" > %t.script
+# RUN: ld.lld %t --script %t.script -o %t2
+# RUN: llvm-readobj -program-headers %t2 | FileCheck %s
+# RUN: llvm-objdump -section-headers %t2 | FileCheck %s --check-prefix=SECTIONS
+
+# CHECK:      ProgramHeaders [
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     VirtualAddress: 0x2000
+# CHECK-NEXT:     PhysicalAddress: 0x6000
+# CHECK-NEXT:     FileSize: 16
+# CHECK-NEXT:     MemSize: 16
+# CHECK-NEXT:     Flags [
+# CHECK-NEXT:       PF_R
+# CHECK-NEXT:       PF_X
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment:
+# CHECK-NEXT:   }
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD
+# CHECK-NEXT:     Offset: 0x2000
+# CHECK-NEXT:     VirtualAddress: 0x3000
+# CHECK-NEXT:     PhysicalAddress: 0x7000
+# CHECK-NEXT:     FileSize: 24
+# CHECK-NEXT:     MemSize: 24
+# CHECK-NEXT:     Flags [
+# CHECK-NEXT:       PF_R
+# CHECK-NEXT:       PF_W
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment: 4096
+# CHECK-NEXT:   }
+
+# SECTIONS:      Sections:
+# SECTIONS-NEXT: Idx Name          Size      Address
+# SECTIONS-NEXT:   0               00000000 0000000000000000
+# SECTIONS-NEXT:   1 .foo1         00000008 0000000000002000
+# SECTIONS-NEXT:   2 .foo2         00000008 0000000000002008
+# SECTIONS-NEXT:   3 .text         00000000 0000000000002010
+# SECTIONS-NEXT:   4 .bar1         00000008 0000000000003000
+# SECTIONS-NEXT:   5 .bar2         00000008 0000000000003008
+# SECTIONS-NEXT:   6 .bar3         00000008 0000000000003010
+  
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: echo "MEMORY {                                            \
+# RUN:   FLASH (ax) : ORIGIN = 0x2000, LENGTH = 0x100            \
+# RUN:   RAM (aw)   : ORIGIN = 0x5000, LENGTH = 0x100 }          \
+# RUN: SECTIONS {                                                \
+# RUN:  .foo1 : AT(0x500) { *(.foo1) } > FLASH AT>FLASH          \
+# RUN: }" > %t2.script
+# RUN: not ld.lld %t --script %t2.script -o %t2 2>&1 | \
+# RUN:   FileCheck %s --check-prefix=ERR
+# ERR: error: section can't have both LMA and a load region
+
+.section .foo1, "ax"
+.quad 0
+
+.section .foo2, "ax"
+.quad 0
+
+.section .bar1, "aw"
+.quad 0
+
+.section .bar2, "aw"
+.quad 0
+
+.section .bar3, "aw"
+.quad 0

Added: vendor/lld/dist-release_60/test/ELF/linkerscript/compress-debug-sections-custom.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/linkerscript/compress-debug-sections-custom.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,35 @@
+# REQUIRES: x86, zlib
+
+# RUN: echo "SECTIONS { \
+# RUN:          .text : { . += 0x10; *(.text) } \
+# RUN:          .debug_str : { . += 0x10; *(.debug_str) } \
+# RUN:          .debug_info : { . += 0x10; *(.debug_info) } \
+# RUN:          }" > %t.script
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/../Inputs/compress-debug.s -o %t2.o
+# RUN: ld.lld %t2.o %t.o -o %t1 --compress-debug-sections=zlib -T %t.script
+# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s
+# These two checks correspond to the patched values of a_sym and a_debug_sym.
+# T = 0x54 - address of .text input section for this file (the start address of
+#     .text is 0 by default, the size of the preceding .text in the other input
+#	  file is 0x44, and the linker script adds an additional 0x10).
+# S = 0x53 - offset of .debug_info section for this file (the size of
+#     the preceding .debug_info from the other input file is 0x43, and the
+#	  linker script adds an additional 0x10).
+# Also note that the .debug_str offsets are also offset by 0x10, as directed by
+# the linker script.
+# CHECK: 0x00000010: "T"
+# CHECK: 0x00000014: "S"
+
+.text
+a_sym:
+nop
+
+.section .debug_str,"",@progbits
+.long a_sym
+.long a_debug_sym
+
+.section .debug_info,"",@progbits
+a_debug_sym:
+.long 0x88776655

Added: vendor/lld/dist-release_60/test/ELF/linkerscript/parse-section-in-addr.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/linkerscript/parse-section-in-addr.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+
+# RUN: echo "SECTIONS {                                   \
+# RUN:         .foo-bar : AT(ADDR(.foo-bar)) { *(.text) } \
+# RUN:       }" > %t.script
+# RUN: ld.lld -o %t.so --script %t.script %t.o -shared
+# RUN: llvm-readelf -S %t.so | FileCheck %s
+
+# CHECK: .foo-bar

Added: vendor/lld/dist-release_60/test/ELF/sysv-hash-no-rosegment.s
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lld/dist-release_60/test/ELF/sysv-hash-no-rosegment.s	Wed Jan 24 20:26:03 2018	(r328370)
@@ -0,0 +1,13 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld -shared --no-rosegment -o %t %t.o
+# RUN: llvm-readobj -hash-table %t | FileCheck %s
+
+# CHECK:      HashTable {
+# CHECK-NEXT:   Num Buckets: 2
+# CHECK-NEXT:   Num Chains: 2
+# CHECK-NEXT:   Buckets: [1, 0]
+# CHECK-NEXT:   Chains: [0, 0]
+# CHECK-NEXT: }
+
+callq undef@PLT



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