[lld] r189505 - [PECOFF] Make command line options case insensitive to match link.exe's behavior.
Rui Ueyama
ruiu at google.com
Wed Aug 28 13:27:41 PDT 2013
Author: ruiu
Date: Wed Aug 28 15:27:41 2013
New Revision: 189505
URL: http://llvm.org/viewvc/llvm-project?rev=189505&view=rev
Log:
[PECOFF] Make command line options case insensitive to match link.exe's behavior.
Modified:
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/test/pecoff/Inputs/imagebase.obj.yaml
lld/trunk/test/pecoff/Inputs/nop.obj.yaml
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=189505&r1=189504&r2=189505&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Wed Aug 28 15:27:41 2013
@@ -60,7 +60,11 @@ static const llvm::opt::OptTable::Info i
// 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.
Modified: lld/trunk/test/pecoff/Inputs/imagebase.obj.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/imagebase.obj.yaml?rev=189505&r1=189504&r2=189505&view=diff
==============================================================================
--- lld/trunk/test/pecoff/Inputs/imagebase.obj.yaml (original)
+++ lld/trunk/test/pecoff/Inputs/imagebase.obj.yaml Wed Aug 28 15:27:41 2013
@@ -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
...
Modified: lld/trunk/test/pecoff/Inputs/nop.obj.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/nop.obj.yaml?rev=189505&r1=189504&r2=189505&view=diff
==============================================================================
--- lld/trunk/test/pecoff/Inputs/nop.obj.yaml (original)
+++ lld/trunk/test/pecoff/Inputs/nop.obj.yaml Wed Aug 28 15:27:41 2013
@@ -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
...
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=189505&r1=189504&r2=189505&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Wed Aug 28 15:27:41 2013
@@ -68,6 +68,15 @@ TEST_F(WinLinkParserTest, UnixStyleOptio
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();
More information about the llvm-commits
mailing list