[PATCH] D55276: ELF: allow non allocated sections to go into allocated sections
Andrew Kelley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 4 10:42:27 PST 2018
andrewrk updated this revision to Diff 176673.
andrewrk added a comment.
Added Rui's test case. Thank you for helping me with that. Please note that I do not have commit privileges and so someone will have to merge this on my behalf.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55276/new/
https://reviews.llvm.org/D55276
Files:
lld/ELF/OutputSections.cpp
lld/test/ELF/linkerscript/merge-nonalloc.s
Index: lld/test/ELF/linkerscript/merge-nonalloc.s
===================================================================
--- /dev/null
+++ lld/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/ELF/OutputSections.cpp
===================================================================
--- lld/ELF/OutputSections.cpp
+++ lld/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.176673.patch
Type: text/x-patch
Size: 1194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/4b579b50/attachment.bin>
More information about the llvm-commits
mailing list