diff options
author | Rui Ueyama <ruiu@google.com> | 2013-08-28 20:27:41 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2013-08-28 20:27:41 +0000 |
commit | 9d52a94cd15c984af288bba3c2033e9739a4f4cc (patch) | |
tree | 8bfac432c8ac5158fb96811819bbf330040059d9 /lld | |
parent | 8c8e8e237606ea06b14ea887db5a1b637741d48b (diff) | |
download | bcm5719-llvm-9d52a94cd15c984af288bba3c2033e9739a4f4cc.tar.gz bcm5719-llvm-9d52a94cd15c984af288bba3c2033e9739a4f4cc.zip |
[PECOFF] Make command line options case insensitive to match link.exe's behavior.
llvm-svn: 189505
Diffstat (limited to 'lld')
-rw-r--r-- | lld/lib/Driver/WinLinkDriver.cpp | 6 | ||||
-rw-r--r-- | lld/test/pecoff/Inputs/imagebase.obj.yaml | 12 | ||||
-rw-r--r-- | lld/test/pecoff/Inputs/nop.obj.yaml | 12 | ||||
-rw-r--r-- | lld/unittests/DriverTests/WinLinkDriverTest.cpp | 9 |
4 files changed, 14 insertions, 25 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index a49c8c9944b..768ffdfc0d0 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -60,7 +60,11 @@ static const llvm::opt::OptTable::Info infoTable[] = { // Create OptTable class for parsing actual command line arguments class WinLinkOptTable : public llvm::opt::OptTable { public: - WinLinkOptTable() : OptTable(infoTable, llvm::array_lengthof(infoTable)){} + // link.exe's command line options are case insensitive, unlike + // other driver's options for Unix. + WinLinkOptTable() + : OptTable(infoTable, llvm::array_lengthof(infoTable), + /* ignoreCase */ true) {} }; // Split the given string with spaces. diff --git a/lld/test/pecoff/Inputs/imagebase.obj.yaml b/lld/test/pecoff/Inputs/imagebase.obj.yaml index cd593571b8b..b2f96898f80 100644 --- a/lld/test/pecoff/Inputs/imagebase.obj.yaml +++ b/lld/test/pecoff/Inputs/imagebase.obj.yaml @@ -15,10 +15,6 @@ sections: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] Alignment: 16 SectionData: "" - - Name: .drectve - Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 - SectionData: 2F454E5452593A5F737461727420 symbols: - Name: .text Value: 0 @@ -48,12 +44,4 @@ symbols: SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: .drectve - Value: 0 - SectionNumber: 3 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - NumberOfAuxSymbols: 1 - AuxiliaryData: 0E0000000000000000000000000000000000 ... diff --git a/lld/test/pecoff/Inputs/nop.obj.yaml b/lld/test/pecoff/Inputs/nop.obj.yaml index b2f8939171b..1afadb4dc72 100644 --- a/lld/test/pecoff/Inputs/nop.obj.yaml +++ b/lld/test/pecoff/Inputs/nop.obj.yaml @@ -15,10 +15,6 @@ sections: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 1 SectionData: 04000000F10000005D0000002200011100000000433A5C63796777696E5C686F6D655C727569755C6E6F702E6F626A0037003C1103020000030000000000000000000A0000001B9D01004D6963726F736F667420285229204D6163726F20417373656D626C65720000000000 - - Name: .drectve - Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] - Alignment: 2147483648 - SectionData: 2F454E5452593A737461727420 symbols: - Name: "@comp.id" Value: 10394907 @@ -56,12 +52,4 @@ symbols: SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: .drectve - Value: 0 - SectionNumber: 4 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - NumberOfAuxSymbols: 1 - AuxiliaryData: 0D0000000000000000000000000000000000 ... diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp index a70b20b1aed..74e47c1432f 100644 --- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp +++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp @@ -68,6 +68,15 @@ TEST_F(WinLinkParserTest, UnixStyleOption) { EXPECT_EQ("a.obj", inputFile(0)); } +TEST_F(WinLinkParserTest, UppercaseOption) { + EXPECT_FALSE(parse("link.exe", "/SUBSYSTEM:CONSOLE", "/OUT:a.exe", "a.obj", + nullptr)); + EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _context.getSubsystem()); + EXPECT_EQ("a.exe", _context.outputPath()); + EXPECT_EQ(1, inputFileCount()); + EXPECT_EQ("a.obj", inputFile(0)); +} + TEST_F(WinLinkParserTest, Mllvm) { EXPECT_FALSE(parse("link.exe", "-mllvm", "-debug", "a.obj", nullptr)); const std::vector<const char *> &options = _context.llvmOptions(); |