Skip to content
Snippets Groups Projects
Commit ac0f7ca3 authored by Rui Ueyama's avatar Rui Ueyama
Browse files

[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
parent 8a5a094e
No related branches found
No related tags found
No related merge requests found
...@@ -145,9 +145,11 @@ def rpath_link : Separate<["-"], "rpath-link">, ...@@ -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) { ...@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment