[lld] r186957 - [PECOFF] Support -tsaware:no command line option.
Rui Ueyama
ruiu at google.com
Tue Jul 23 10:17:19 PDT 2013
Author: ruiu
Date: Tue Jul 23 12:17:19 2013
New Revision: 186957
URL: http://llvm.org/viewvc/llvm-project?rev=186957&view=rev
Log:
[PECOFF] Support -tsaware:no command line option.
Modified:
lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/Driver/WinLinkOptions.td
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h?rev=186957&r1=186956&r2=186957&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h Tue Jul 23 12:17:19 2013
@@ -28,7 +28,8 @@ public:
: _baseAddress(0x400000), _stackReserve(1024 * 1024), _stackCommit(4096),
_heapReserve(1024 * 1024), _heapCommit(4096),
_subsystem(llvm::COFF::IMAGE_SUBSYSTEM_UNKNOWN), _minOSVersion(6, 0),
- _nxCompat(true), _largeAddressAware(false), _baseRelocationEnabled(true) {}
+ _nxCompat(true), _largeAddressAware(false), _baseRelocationEnabled(true),
+ _terminalServerAware(true) {}
struct OSVersion {
OSVersion(int v1, int v2) : majorVersion(v1), minorVersion(v2) {}
@@ -76,7 +77,7 @@ public:
OSVersion getMinOSVersion() const { return _minOSVersion; }
void setNxCompat(bool nxCompat) { _nxCompat = nxCompat; }
- bool getNxCompat() const { return _nxCompat; }
+ bool isNxCompat() const { return _nxCompat; }
void setLargeAddressAware(bool val) { _largeAddressAware = val; }
bool getLargeAddressAware() const { return _largeAddressAware; }
@@ -84,6 +85,9 @@ public:
void setBaseRelocationEnabled(bool val) { _baseRelocationEnabled = val; }
bool getBaseRelocationEnabled() const { return _baseRelocationEnabled; }
+ void setTerminalServerAware(bool val) { _terminalServerAware = val; }
+ bool isTerminalServerAware() const { return _terminalServerAware; }
+
virtual ErrorOr<Reference::Kind> relocKindFromString(StringRef str) const;
virtual ErrorOr<std::string> stringFromRelocKind(Reference::Kind kind) const;
@@ -108,6 +112,7 @@ private:
bool _nxCompat;
bool _largeAddressAware;
bool _baseRelocationEnabled;
+ bool _terminalServerAware;
std::vector<StringRef> _inputSearchPaths;
mutable std::unique_ptr<Reader> _reader;
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=186957&r1=186956&r2=186957&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Jul 23 12:17:19 2013
@@ -347,6 +347,10 @@ bool WinLinkDriver::parse(int argc, cons
if (parsedArgs->getLastArg(OPT_fixed))
info.setBaseRelocationEnabled(false);
+ // Handle -tsaware:no
+ if (parsedArgs->getLastArg(OPT_no_tsaware))
+ info.setTerminalServerAware(false);
+
// Handle -out
if (llvm::opt::Arg *outpath = parsedArgs->getLastArg(OPT_out))
info.setOutputPath(outpath->getValue());
Modified: lld/trunk/lib/Driver/WinLinkOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkOptions.td?rev=186957&r1=186956&r2=186957&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkOptions.td (original)
+++ lld/trunk/lib/Driver/WinLinkOptions.td Tue Jul 23 12:17:19 2013
@@ -55,5 +55,10 @@ def fixed : Flag<["-", "/"], "fixed">,
def no_fixed : Flag<["-", "/"], "fixed:no">,
HelpText<"Enable base relocations">;
+def tsaware : Flag<["-", "/"], "tsaware">,
+ HelpText<"Create Terminal Server aware executable">;
+def no_tsaware : Flag<["-", "/"], "tsaware:no">,
+ HelpText<"Create non-Terminal Server aware executable">;
+
def help : Flag<["-", "/"], "help">;
def help_q : Flag<["-", "/"], "?">, Alias<help>;
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=186957&r1=186956&r2=186957&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Tue Jul 23 12:17:19 2013
@@ -196,9 +196,11 @@ public:
// them.
uint16_t dllCharacteristics =
llvm::COFF::IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE |
- llvm::COFF::IMAGE_DLL_CHARACTERISTICS_NO_SEH |
- llvm::COFF::IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE;
- if (targetInfo.getNxCompat())
+ 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;
_peHeader.DLLCharacteristics = dllCharacteristics;
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=186957&r1=186956&r2=186957&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Tue Jul 23 12:17:19 2013
@@ -50,9 +50,10 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_EQ(1024 * 1024ULL, _info.getStackReserve());
EXPECT_EQ(4096ULL, _info.getStackCommit());
EXPECT_FALSE(_info.allowRemainingUndefines());
- EXPECT_TRUE(_info.getNxCompat());
+ EXPECT_TRUE(_info.isNxCompat());
EXPECT_FALSE(_info.getLargeAddressAware());
EXPECT_TRUE(_info.getBaseRelocationEnabled());
+ EXPECT_TRUE(_info.isTerminalServerAware());
}
TEST_F(WinLinkParserTest, WindowsStyleOption) {
@@ -138,7 +139,7 @@ TEST_F(WinLinkParserTest, Force) {
TEST_F(WinLinkParserTest, NoNxCompat) {
EXPECT_FALSE(parse("link.exe", "-nxcompat:no", "a.obj", nullptr));
- EXPECT_FALSE(_info.getNxCompat());
+ EXPECT_FALSE(_info.isNxCompat());
}
TEST_F(WinLinkParserTest, LargeAddressAware) {
@@ -161,6 +162,16 @@ TEST_F(WinLinkParserTest, NoFixed) {
EXPECT_TRUE(_info.getBaseRelocationEnabled());
}
+TEST_F(WinLinkParserTest, TerminalServerAware) {
+ EXPECT_FALSE(parse("link.exe", "-tsaware", "a.out", nullptr));
+ EXPECT_TRUE(_info.isTerminalServerAware());
+}
+
+TEST_F(WinLinkParserTest, NoTerminalServerAware) {
+ EXPECT_FALSE(parse("link.exe", "-tsaware:no", "a.out", nullptr));
+ EXPECT_FALSE(_info.isTerminalServerAware());
+}
+
TEST_F(WinLinkParserTest, NoInputFiles) {
EXPECT_TRUE(parse("link.exe", nullptr));
EXPECT_EQ("No input files\n", errorMessage());
More information about the llvm-commits
mailing list