[PATCH] D55276: ELF: allow non allocated sections to go into allocated sections

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 10:52:07 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348291: ELF: allow non allocated sections to go into allocated sections (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55276?vs=176673&id=176674#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55276/new/

https://reviews.llvm.org/D55276

Files:
  lld/trunk/ELF/OutputSections.cpp
  lld/trunk/test/ELF/linkerscript/merge-nonalloc.s


Index: lld/trunk/test/ELF/linkerscript/merge-nonalloc.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/merge-nonalloc.s
+++ lld/trunk/test/ELF/linkerscript/merge-nonalloc.s
@@ -0,0 +1,14 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "SECTIONS { .text : { *(.text) *(.nonalloc) } }" > %t.script
+# RUN: ld.lld -shared -o %t.exe %t.script %t.o
+# RUN: llvm-objdump -syms %t.exe | FileCheck %s
+
+# CHECK: .text 00000000 nonalloc_start
+
+_start:
+  nop
+
+.section .nonalloc,"", at progbits
+nonalloc_start:
+  .long 0xcafe
Index: lld/trunk/ELF/OutputSections.cpp
===================================================================
--- lld/trunk/ELF/OutputSections.cpp
+++ lld/trunk/ELF/OutputSections.cpp
@@ -95,7 +95,7 @@
     Flags = IS->Flags;
   } else {
     // Otherwise, check if new type or flags are compatible with existing ones.
-    unsigned Mask = SHF_ALLOC | SHF_TLS | SHF_LINK_ORDER;
+    unsigned Mask = SHF_TLS | SHF_LINK_ORDER;
     if ((Flags & Mask) != (IS->Flags & Mask))
       error("incompatible section flags for " + Name + "\n>>> " + toString(IS) +
             ": 0x" + utohexstr(IS->Flags) + "\n>>> output section " + Name +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55276.176674.patch
Type: text/x-patch
Size: 1263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/d5a14da6/attachment.bin>


More information about the llvm-commits mailing list