forked from OSchip/llvm-project
[PECOFF] Support -tsaware:no command line option.
llvm-svn: 186957
This commit is contained in:
parent
ca0be23b39
commit
fbf5763708
|
@ -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;
|
||||
|
|
|
@ -347,6 +347,10 @@ bool WinLinkDriver::parse(int argc, const char *argv[],
|
|||
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());
|
||||
|
|
|
@ -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>;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue