[llvm-branch-commits] [lld] r339986 - Merging r339904:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 17 00:08:25 PDT 2018


Author: hans
Date: Fri Aug 17 00:08:25 2018
New Revision: 339986

URL: http://llvm.org/viewvc/llvm-project?rev=339986&view=rev
Log:
Merging r339904:
------------------------------------------------------------------------
r339904 | maskray | 2018-08-16 19:22:02 +0200 (Thu, 16 Aug 2018) | 11 lines

[ELF] mergeSections: remove non-alive MergeInputSection

Summary: This makes it conform to what the comment says. Otherwise when getErrPlace() is called afterwards, cast<InputSection>(D) will cause incompatible cast as MergeInputSection is not a subclass of InputSection.

Reviewers: ruiu, grimar, espindola, pcc

Reviewed By: grimar

Subscribers: emaste, arichardson, llvm-commits

Differential Revision: https://reviews.llvm.org/D50742
------------------------------------------------------------------------

Modified:
    lld/branches/release_70/   (props changed)
    lld/branches/release_70/ELF/SyntheticSections.cpp
    lld/branches/release_70/test/ELF/x86-64-reloc-error2.s

Propchange: lld/branches/release_70/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 17 00:08:25 2018
@@ -1 +1 @@
-/lld/trunk:338679,338684,338697,338699,339049,339058,339075
+/lld/trunk:338679,338684,338697,338699,339049,339058,339075,339904

Modified: lld/branches/release_70/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_70/ELF/SyntheticSections.cpp?rev=339986&r1=339985&r2=339986&view=diff
==============================================================================
--- lld/branches/release_70/ELF/SyntheticSections.cpp (original)
+++ lld/branches/release_70/ELF/SyntheticSections.cpp Fri Aug 17 00:08:25 2018
@@ -2929,8 +2929,10 @@ void elf::mergeSections() {
 
     // We do not want to handle sections that are not alive, so just remove
     // them instead of trying to merge.
-    if (!MS->Live)
+    if (!MS->Live) {
+      S = nullptr;
       continue;
+    }
 
     StringRef OutsecName = getOutputSectionName(MS);
     uint32_t Alignment = std::max<uint32_t>(MS->Alignment, MS->Entsize);

Modified: lld/branches/release_70/test/ELF/x86-64-reloc-error2.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_70/test/ELF/x86-64-reloc-error2.s?rev=339986&r1=339985&r2=339986&view=diff
==============================================================================
--- lld/branches/release_70/test/ELF/x86-64-reloc-error2.s (original)
+++ lld/branches/release_70/test/ELF/x86-64-reloc-error2.s Fri Aug 17 00:08:25 2018
@@ -1,14 +1,18 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
+# RUN: not ld.lld --entry=func --gc-sections %t.o -o /dev/null 2>&1 | FileCheck %s
 
 ## Check we are able to find a function symbol that encloses
 ## a given location when reporting error messages.
 # CHECK: {{.*}}.o:(function func): relocation R_X86_64_32S out of range: -281474974609408 is not in [-2147483648, 2147483647]
 
+# This mergeable section will be garbage collected. We had a crash issue in that case. Test it.
+.section .rodata.str1,"aMS", at progbits,1
+.asciz "a"
+
 .section .text.func, "ax", %progbits
 .globl func
 .type func, at function
-.size func, 0x10
 func:
- movq func - 0x1000000000000, %rdx
+  movq $func - 0x1000000000000, %rdx
+.size func, .-func




More information about the llvm-branch-commits mailing list