[lld] r187221 - [PECOFF] Don't set IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE if "-fixed" is provided
Rui Ueyama
ruiu at google.com
Fri Jul 26 10:30:39 PDT 2013
Author: ruiu
Date: Fri Jul 26 12:30:39 2013
New Revision: 187221
URL: http://llvm.org/viewvc/llvm-project?rev=187221&view=rev
Log:
[PECOFF] Don't set IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE if "-fixed" is provided
Based on Ron Ofir's patch.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
lld/trunk/test/pecoff/base-reloc.test
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=187221&r1=187220&r2=187221&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Fri Jul 26 12:30:39 2013
@@ -195,13 +195,14 @@ public:
// be set, but regular binaries seem to have these bits, so we follow
// them.
uint16_t dllCharacteristics =
- llvm::COFF::IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE |
llvm::COFF::IMAGE_DLL_CHARACTERISTICS_NO_SEH;
if (targetInfo.isTerminalServerAware())
dllCharacteristics |=
llvm::COFF::IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE;
if (targetInfo.isNxCompat())
dllCharacteristics |= llvm::COFF::IMAGE_DLL_CHARACTERISTICS_NX_COMPAT;
+ if (targetInfo.getBaseRelocationEnabled())
+ dllCharacteristics |= llvm::COFF::IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE;
_peHeader.DLLCharacteristics = dllCharacteristics;
_peHeader.SizeOfStackReserve = targetInfo.getStackReserve();
Modified: lld/trunk/test/pecoff/base-reloc.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/base-reloc.test?rev=187221&r1=187220&r2=187221&view=diff
==============================================================================
--- lld/trunk/test/pecoff/base-reloc.test (original)
+++ lld/trunk/test/pecoff/base-reloc.test Fri Jul 26 12:30:39 2013
@@ -1,10 +1,10 @@
# RUN: yaml2obj %p/Inputs/hello.obj.yaml > %t.obj
#
# RUN: lld -flavor link /out:%t1 /subsystem:console /force -- %t.obj \
-# RUN: && llvm-objdump -s %t1 | FileCheck %s --check-prefix=BASEREL
+# RUN: && llvm-objdump -s %t1 | FileCheck %s --check-prefix=BASEREL-SECTION
#
# RUN: lld -flavor link /out:%t1 /subsystem:console /force /fixed -- %t.obj \
-# RUN: && llvm-objdump -s %t1 | FileCheck %s --check-prefix=NOBASEREL
+# RUN: && llvm-objdump -s %t1 | FileCheck %s --check-prefix=NOBASEREL-SECTION
# Because llvm-objdump cannot pretty-print the contents of .reloc section, we
# have no choice other than comparing the result with this binary blob.
@@ -12,7 +12,19 @@
# TODO: Improve llvm-objdump to pretty print .reloc section as GNU binutil
# objdump does.
-BASEREL: Contents of section .reloc:
-BASEREL-NEXT: 3000 00100000 0c000000 07300c30 00000000 .........0.0....
+BASEREL-SECTION: Contents of section .reloc:
+BASEREL-SECTION-NEXT: 3000 00100000 0c000000 07300c30 00000000 .........0.0....
-NOBASEREL-NOT: Contents of section .reloc:
+NOBASEREL-SECTION-NOT: Contents of section .reloc:
+
+# RUN: lld -flavor link /out:%t1 /subsystem:console /force -- %t.obj \
+# RUN: && llvm-readobj -file-headers %t1 \
+# RUN: | FileCheck %s --check-prefix=BASEREL-HEADER
+#
+# RUN: lld -flavor link /out:%t1 /subsystem:console /force /fixed -- %t.obj \
+# RUN: && llvm-readobj -file-headers %t1 \
+# RUN: | FileCheck %s --check-prefix=NOBASEREL-HEADER
+
+BASEREL-HEADER: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
+
+NOBASEREL-HEADER-NOT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
\ No newline at end of file
More information about the llvm-commits
mailing list