[ELF] Fix --soname option.
Currently LLD accepts only "-soname <string>", but all the following options are actually valid. --soname=foo --soname foo -soname=foo -soname foo -h foo This patch fixes that issue. llvm-svn: 205662
This commit is contained in:
		
							parent
							
								
									8a5a094ec5
								
							
						
					
					
						commit
						ac0f7ca3a8
					
				| 
						 | 
					@ -145,9 +145,11 @@ def rpath_link : Separate<["-"], "rpath-link">,
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
def grp_dynlib : OptionGroup<"opts">,
 | 
					def grp_dynlib : OptionGroup<"opts">,
 | 
				
			||||||
     HelpText<"DYNAMIC LIBRARY OPTIONS">;
 | 
					     HelpText<"DYNAMIC LIBRARY OPTIONS">;
 | 
				
			||||||
def soname : Separate<["-"], "soname">,
 | 
					def soname : Joined<["-", "--"], "soname=">,
 | 
				
			||||||
     HelpText<"Set the internal DT_SONAME field to the specified name">,
 | 
					     HelpText<"Set the internal DT_SONAME field to the specified name">,
 | 
				
			||||||
     Group<grp_dynlib>;
 | 
					     Group<grp_dynlib>;
 | 
				
			||||||
 | 
					def soname_separate : Separate<["-", "--"], "soname">, Alias<soname>;
 | 
				
			||||||
 | 
					def soname_h : Separate<["-"], "h">, Alias<soname>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
/// Resolver Options
 | 
					/// Resolver Options
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,6 +40,26 @@ TEST_F(GnuLdParserTest, Empty) {
 | 
				
			||||||
  EXPECT_EQ("No input files\n", errorMessage());
 | 
					  EXPECT_EQ("No input files\n", errorMessage());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// --soname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_F(GnuLdParserTest, SOName) {
 | 
				
			||||||
 | 
					  EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "--soname=foo",
 | 
				
			||||||
 | 
					                    nullptr));
 | 
				
			||||||
 | 
					  EXPECT_EQ("foo", _context->sharedObjectName());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_F(GnuLdParserTest, SONameSingleDash) {
 | 
				
			||||||
 | 
					  EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "-soname=foo",
 | 
				
			||||||
 | 
					                    nullptr));
 | 
				
			||||||
 | 
					  EXPECT_EQ("foo", _context->sharedObjectName());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_F(GnuLdParserTest, SONameH) {
 | 
				
			||||||
 | 
					  EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "-h", "foo",
 | 
				
			||||||
 | 
					                    nullptr));
 | 
				
			||||||
 | 
					  EXPECT_EQ("foo", _context->sharedObjectName());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Tests for --defsym
 | 
					// Tests for --defsym
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST_F(GnuLdParserTest, DefsymDecimal) {
 | 
					TEST_F(GnuLdParserTest, DefsymDecimal) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue