[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:
Rui Ueyama 2014-04-05 02:07:04 +00:00
parent 8a5a094ec5
commit ac0f7ca3a8
2 changed files with 23 additions and 1 deletions

View File

@ -145,9 +145,11 @@ def rpath_link : Separate<["-"], "rpath-link">,
//===----------------------------------------------------------------------===//
def grp_dynlib : OptionGroup<"opts">,
HelpText<"DYNAMIC LIBRARY OPTIONS">;
def soname : Separate<["-"], "soname">,
def soname : Joined<["-", "--"], "soname=">,
HelpText<"Set the internal DT_SONAME field to the specified name">,
Group<grp_dynlib>;
def soname_separate : Separate<["-", "--"], "soname">, Alias<soname>;
def soname_h : Separate<["-"], "h">, Alias<soname>;
//===----------------------------------------------------------------------===//
/// Resolver Options

View File

@ -40,6 +40,26 @@ TEST_F(GnuLdParserTest, Empty) {
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
TEST_F(GnuLdParserTest, DefsymDecimal) {