[PATCH] D40197: Merge .xdata into .rdata by default
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 17 14:26:01 PST 2017
rnk created this revision.
MSVC does this. The user can override it with their own /merge: flag.
https://reviews.llvm.org/D40197
Files:
lld/COFF/Driver.cpp
lld/test/COFF/icf-xdata.s
Index: lld/test/COFF/icf-xdata.s
===================================================================
--- lld/test/COFF/icf-xdata.s
+++ lld/test/COFF/icf-xdata.s
@@ -1,13 +1,23 @@
# RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj
+# RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata 2>&1 \
+# RUN: | FileCheck %s --check-prefix=WARN
+# RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=XDATA
# RUN: lld-link %t.obj -dll -noentry -out:%t.dll
-# RUN: llvm-readobj -sections %t.dll | FileCheck %s
+# RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=RDATA
# There shouldn't be much xdata, because all three .pdata entries (12 bytes
# each) should use the same .xdata unwind info.
-# CHECK: Name: .pdata
-# CHECK-NEXT: VirtualSize: 0x24
-# CHECK: Name: .xdata
-# CHECK-NEXT: VirtualSize: 0x8
+# XDATA: Name: .pdata
+# XDATA-NEXT: VirtualSize: 0x24
+# XDATA: Name: .xdata
+# XDATA-NEXT: VirtualSize: 0x8
+#
+# WARN: warning: .xdata=.rdata: already merged into .xdata
+#
+# RDATA: Name: .pdata
+# RDATA-NEXT: VirtualSize: 0x24
+# RDATA: Name: .rdata
+# RDATA-NEXT: VirtualSize: 0x8
.text
callee:
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -966,6 +966,10 @@
for (auto *Arg : Args.filtered(OPT_merge))
parseMerge(Arg->getValue());
+ // Add default section merging rules after user rules. User rules take
+ // precedence, but we will emit a warning if there is a conflict.
+ parseMerge(".xdata=.rdata");
+
// Handle /section
for (auto *Arg : Args.filtered(OPT_section))
parseSection(Arg->getValue());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40197.123420.patch
Type: text/x-patch
Size: 1767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171117/5c6cd7bb/attachment.bin>
More information about the llvm-commits
mailing list