[PATCH] [PECOFF] Fixed base images now have the IMAGE_FILE_RELOCS_STRIPPED flag
Ron Ofir
ron.ofir at gmail.com
Fri Aug 2 12:24:07 PDT 2013
Hi ruiu,
Change WriterPECOFF to set the IMAGE_FILE_RELOCS_STRIPPED characteristic in the PE header when creating fixed base images
http://llvm-reviews.chandlerc.com/D1273
Files:
lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
test/pecoff/base-reloc.test
Index: lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
===================================================================
--- lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -155,6 +155,9 @@
llvm::COFF::IMAGE_FILE_EXECUTABLE_IMAGE;
if (targetInfo.getLargeAddressAware())
characteristics |= llvm::COFF::IMAGE_FILE_LARGE_ADDRESS_AWARE;
+ if (!targetInfo.getBaseRelocationEnabled())
+ characteristics |= llvm::COFF::IMAGE_FILE_RELOCS_STRIPPED;
+
_coffHeader.Characteristics = characteristics;
// 0x10b indicates a normal PE32 executable. For PE32+ it should be 0x20b.
Index: test/pecoff/base-reloc.test
===================================================================
--- test/pecoff/base-reloc.test
+++ test/pecoff/base-reloc.test
@@ -25,6 +25,8 @@
# RUN: && llvm-readobj -file-headers %t1 \
# RUN: | FileCheck %s --check-prefix=NOBASEREL-HEADER
+BASEREL-HEADER-NOT: IMAGE_FILE_RELOCS_STRIPPED
BASEREL-HEADER: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
-NOBASEREL-HEADER-NOT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
\ No newline at end of file
+NOBASEREL-HEADER: IMAGE_FILE_RELOCS_STRIPPED
+NOBASEREL-HEADER-NOT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1273.1.patch
Type: text/x-patch
Size: 1262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130802/b53ea61b/attachment.bin>
More information about the llvm-commits
mailing list