[lld] r205662 - [ELF] Fix --soname option.
Rui Ueyama
ruiu at google.com
Fri Apr 4 19:07:04 PDT 2014
Author: ruiu
Date: Fri Apr 4 21:07:04 2014
New Revision: 205662
URL: http://llvm.org/viewvc/llvm-project?rev=205662&view=rev
Log:
[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.
Modified:
lld/trunk/lib/Driver/GnuLdOptions.td
lld/trunk/unittests/DriverTests/GnuLdDriverTest.cpp
Modified: lld/trunk/lib/Driver/GnuLdOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdOptions.td?rev=205662&r1=205661&r2=205662&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdOptions.td (original)
+++ lld/trunk/lib/Driver/GnuLdOptions.td Fri Apr 4 21:07:04 2014
@@ -145,9 +145,11 @@ def rpath_link : Separate<["-"], "rpath-
//===----------------------------------------------------------------------===//
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
Modified: lld/trunk/unittests/DriverTests/GnuLdDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/GnuLdDriverTest.cpp?rev=205662&r1=205661&r2=205662&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/GnuLdDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/GnuLdDriverTest.cpp Fri Apr 4 21:07:04 2014
@@ -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) {
More information about the llvm-commits
mailing list