[llvm] r209273 - MC: mark COFF .drectve section as REMOVE

Rui Ueyama ruiu at google.com
Tue May 20 22:29:03 PDT 2014


LGTM. This matches the output of MSVC.


On Tue, May 20, 2014 at 10:15 PM, Saleem Abdulrasool
<compnerd at compnerd.org>wrote:

> 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: }
> +
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140520/d0d357a3/attachment.html>


More information about the llvm-commits mailing list