[lld] r200106 - [PECOFF] Set PE32+ magic value if 64 bit.
Rui Ueyama
ruiu at google.com
Sat Jan 25 16:35:23 PST 2014
Author: ruiu
Date: Sat Jan 25 18:35:23 2014
New Revision: 200106
URL: http://llvm.org/viewvc/llvm-project?rev=200106&view=rev
Log:
[PECOFF] Set PE32+ magic value if 64 bit.
Added:
lld/trunk/test/pecoff/pe32plus.test
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=200106&r1=200105&r2=200106&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Sat Jan 25 18:35:23 2014
@@ -337,8 +337,8 @@ PEHeaderChunk::PEHeaderChunk(const PECOF
_coffHeader.Characteristics = characteristics;
- // A 32-bit executable has PE32 magic (0x10b).
- _peHeader.Magic = llvm::COFF::PEHeader::PE32;
+ _peHeader.Magic = context.is64Bit() ? llvm::COFF::PE32Header::PE32_PLUS
+ : llvm::COFF::PE32Header::PE32;
// The address of entry point relative to ImageBase. Windows executable
// usually starts at address 0x401000.
Added: lld/trunk/test/pecoff/pe32plus.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/pe32plus.test?rev=200106&view=auto
==============================================================================
--- lld/trunk/test/pecoff/pe32plus.test (added)
+++ lld/trunk/test/pecoff/pe32plus.test Sat Jan 25 18:35:23 2014
@@ -0,0 +1,7 @@
+# RUN: yaml2obj %p/Inputs/nop.obj.yaml > %t.obj
+#
+# RUN: lld -flavor link /machine:x64 /out:%t.exe /subsystem:console /force \
+# RUN: -- %t.obj
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
+
+CHECK: Format: COFF-x86-64
More information about the llvm-commits
mailing list