[PATCH] D33646: [ELF] - Do not crash when linkerscript applies fill to .bss.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 29 22:48:29 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL304192: [ELF] - Do not crash when linkerscript applies fill to .bss. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D33646?vs=100608&id=100663#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33646

Files:
  lld/trunk/ELF/LinkerScript.cpp
  lld/trunk/test/ELF/linkerscript/bss-fill.s


Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -1080,6 +1080,9 @@
     return;
   }
 
+  if (Sec->Type == SHT_NOBITS)
+    return;
+
   // Write leading padding.
   ArrayRef<InputSection *> Sections = Sec->Sections;
   uint32_t Filler = getFiller();
Index: lld/trunk/test/ELF/linkerscript/bss-fill.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/bss-fill.s
+++ lld/trunk/test/ELF/linkerscript/bss-fill.s
@@ -0,0 +1,7 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "SECTIONS { .bss : { . += 0x10000; *(.bss) } =0xFF };" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o
+
+.section .bss,"", at nobits
+.short 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33646.100663.patch
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170530/d3a5fa39/attachment.bin>


More information about the llvm-commits mailing list