[llvm] r209273 - MC: mark COFF .drectve section as REMOVE
Saleem Abdulrasool
compnerd at compnerd.org
Tue May 20 22:15:02 PDT 2014
Author: compnerd
Date: Wed May 21 00:15:01 2014
New Revision: 209273
URL: http://llvm.org/viewvc/llvm-project?rev=209273&view=rev
Log:
MC: mark COFF .drectve section as REMOVE
The .drectve section should be marked as IMAGE_SCN_LNK_REMOVE. This matches what
the MSVC toolchain does and accurately reflects that this section should not be
emitted into the final binary. This section is merely information for the
linker, comprising of additional linker directives.
Added:
llvm/trunk/test/MC/COFF/directive-section-characteristics.ll
Modified:
llvm/trunk/lib/MC/MCObjectFileInfo.cpp
Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=209273&r1=209272&r2=209273&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Wed May 21 00:15:01 2014
@@ -739,7 +739,7 @@ void MCObjectFileInfo::InitCOFFMCObjectF
DrectveSection =
Ctx->getCOFFSection(".drectve",
- COFF::IMAGE_SCN_LNK_INFO,
+ COFF::IMAGE_SCN_LNK_INFO | COFF::IMAGE_SCN_LNK_REMOVE,
SectionKind::getMetadata());
PDataSection =
Added: llvm/trunk/test/MC/COFF/directive-section-characteristics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/directive-section-characteristics.ll?rev=209273&view=auto
==============================================================================
--- llvm/trunk/test/MC/COFF/directive-section-characteristics.ll (added)
+++ llvm/trunk/test/MC/COFF/directive-section-characteristics.ll Wed May 21 00:15:01 2014
@@ -0,0 +1,17 @@
+; RUN: llc -mtriple i686-windows -filetype obj -o - %s | llvm-readobj -sections \
+; RUN: | FileCheck %s
+
+define dllexport void @function() {
+entry:
+ ret void
+}
+
+; CHECK: Section {
+; CHECK: Name: .drectve
+; CHECK: Characteristics [
+; CHECK: IMAGE_SCN_ALIGN_1BYTES
+; CHECK: IMAGE_SCN_LNK_INFO
+; CHECK: IMAGE_SCN_LNK_REMOVE
+; CHECK: ]
+; CHECK: }
+
More information about the llvm-commits
mailing list