[lld] r191227 - [PECOFF] Add /allowisolation command line option.
Rui Ueyama
ruiu at google.com
Mon Sep 23 14:22:01 PDT 2013
Author: ruiu
Date: Mon Sep 23 16:22:01 2013
New Revision: 191227
URL: http://llvm.org/viewvc/llvm-project?rev=191227&view=rev
Log:
[PECOFF] Add /allowisolation command line option.
Modified:
lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/Driver/WinLinkOptions.td
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
lld/trunk/test/pecoff/options.test
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=191227&r1=191226&r2=191227&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Mon Sep 23 16:22:01 2013
@@ -33,7 +33,7 @@ public:
_subsystem(llvm::COFF::IMAGE_SUBSYSTEM_UNKNOWN),
_machineType(llvm::COFF::IMAGE_FILE_MACHINE_I386), _imageVersion(0, 0),
_minOSVersion(6, 0), _nxCompat(true), _largeAddressAware(false),
- _allowBind(true), _baseRelocationEnabled(true),
+ _allowBind(true), _allowIsolation(true), _baseRelocationEnabled(true),
_terminalServerAware(true), _dynamicBaseEnabled(true),
_imageType(ImageType::IMAGE_EXE) {
setDeadStripping(true);
@@ -127,6 +127,9 @@ public:
void setAllowBind(bool val) { _allowBind = val; }
bool getAllowBind() const { return _allowBind; }
+ void setAllowIsolation(bool val) { _allowIsolation = val; }
+ bool getAllowIsolation() const { return _allowIsolation; }
+
void setBaseRelocationEnabled(bool val) { _baseRelocationEnabled = val; }
bool getBaseRelocationEnabled() const { return _baseRelocationEnabled; }
@@ -179,6 +182,7 @@ private:
bool _nxCompat;
bool _largeAddressAware;
bool _allowBind;
+ bool _allowIsolation;
bool _baseRelocationEnabled;
bool _terminalServerAware;
bool _dynamicBaseEnabled;
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=191227&r1=191226&r2=191227&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Mon Sep 23 16:22:01 2013
@@ -429,6 +429,16 @@ bool WinLinkDriver::parse(int argc, cons
ctx.setAllowBind(false);
break;
+ case OPT_allowisolation:
+ // handle /allowisolation
+ ctx.setAllowIsolation(true);
+ break;
+
+ case OPT_allowisolation_no:
+ // handle /allowisolation:no
+ ctx.setAllowIsolation(false);
+ break;
+
case OPT_fixed:
// handle /fixed
Modified: lld/trunk/lib/Driver/WinLinkOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkOptions.td?rev=191227&r1=191226&r2=191227&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkOptions.td (original)
+++ lld/trunk/lib/Driver/WinLinkOptions.td Mon Sep 23 16:22:01 2013
@@ -52,6 +52,7 @@ defm largeaddressaware : B<"largeaddress
defm allowbind: B<"allowbind", "Disable DLL binding">;
defm fixed : B<"fixed", "Enable base relocations">;
defm tsaware : B<"tsaware", "Create non-Terminal Server aware executable">;
+defm allowisolation : B<"allowisolation", "Set NO_ISOLATION bit">;
defm dynamicbase : B<"dynamicbase",
"Disable address space layout randomization">;
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=191227&r1=191226&r2=191227&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Mon Sep 23 16:22:01 2013
@@ -212,6 +212,8 @@ public:
dllCharacteristics |= llvm::COFF::IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE;
if (!context.getAllowBind())
dllCharacteristics |= llvm::COFF::IMAGE_DLL_CHARACTERISTICS_NO_BIND;
+ if (!context.getAllowIsolation())
+ dllCharacteristics |= llvm::COFF::IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION;
_peHeader.DLLCharacteristics = dllCharacteristics;
_peHeader.SizeOfStackReserve = context.getStackReserve();
Modified: lld/trunk/test/pecoff/options.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/options.test?rev=191227&r1=191226&r2=191227&view=diff
==============================================================================
--- lld/trunk/test/pecoff/options.test (original)
+++ lld/trunk/test/pecoff/options.test Mon Sep 23 16:22:01 2013
@@ -8,5 +8,10 @@ ALIGN: SectionAlignment: 8192
# RUN: lld -flavor link /allowbind:no /out:%t.exe /entry:start -- %t.obj \
# RUN: && llvm-readobj -file-headers %t.exe \
-# RUN: | FileCheck -check-prefix=ALLOWBIND %s
-ALLOWBIND: IMAGE_DLL_CHARACTERISTICS_NO_BIND
+# RUN: | FileCheck -check-prefix=NOBIND %s
+NOBIND: IMAGE_DLL_CHARACTERISTICS_NO_BIND
+
+# RUN: lld -flavor link /allowisolation:no /out:%t.exe /entry:start -- %t.obj \
+# RUN: && llvm-readobj -file-headers %t.exe \
+# RUN: | FileCheck -check-prefix=NOISOLATION %s
+NOISOLATION: IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=191227&r1=191226&r2=191227&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Mon Sep 23 16:22:01 2013
@@ -54,6 +54,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_TRUE(_context.isNxCompat());
EXPECT_FALSE(_context.getLargeAddressAware());
EXPECT_TRUE(_context.getAllowBind());
+ EXPECT_TRUE(_context.getAllowIsolation());
EXPECT_TRUE(_context.getBaseRelocationEnabled());
EXPECT_TRUE(_context.isTerminalServerAware());
EXPECT_TRUE(_context.getDynamicBaseEnabled());
@@ -217,6 +218,16 @@ TEST_F(WinLinkParserTest, NoAllowBind) {
EXPECT_FALSE(_context.getAllowBind());
}
+TEST_F(WinLinkParserTest, AllowIsolation) {
+ EXPECT_FALSE(parse("link.exe", "/allowisolation", "a.obj", nullptr));
+ EXPECT_TRUE(_context.getAllowIsolation());
+}
+
+TEST_F(WinLinkParserTest, NoAllowIsolation) {
+ EXPECT_FALSE(parse("link.exe", "/allowisolation:no", "a.obj", nullptr));
+ EXPECT_FALSE(_context.getAllowIsolation());
+}
+
TEST_F(WinLinkParserTest, Fixed) {
EXPECT_FALSE(parse("link.exe", "/fixed", "a.out", nullptr));
EXPECT_FALSE(_context.getBaseRelocationEnabled());
More information about the llvm-commits
mailing list