summaryrefslogtreecommitdiff
path: root/gold/options.cc
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2009-05-26 22:52:56 +0000
committerDoug Kwan <dougkwan@google.com>2009-05-26 22:52:56 +0000
commit2fdd743f6d30838e94d0c23518028513e6803095 (patch)
treec82d549ef87c282155cf898bb40bd0a50a37d496 /gold/options.cc
parent68d7e96a436ae00396227dca4668999b7a4bceef (diff)
2009-05-26 Doug Kwan <dougkwan@google.com>
* options.cc (General_options::parse_exclude_libs). Fix a comment. (General_options::check_excluded_libs): Strip off directories in archive name before matching like GNU ld does. * testsuite/Makefile.am (MOSTLYCLEANFILES, exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a (exclude_libs_test_LDFLAGS): Add linker option -Wl,--exclude-libs,libexclude_libs_test_3 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as an explicit archive without using -l. (alt/libexclude_libs_test_3.a): New make rule. * testsuite/Makefile.in: Regenerate. * testsuite/exclude_libs_test.c : Declare lib3_default(). (main): Call it. * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a. * exclude_libs_test_3.c: New file.
Diffstat (limited to 'gold/options.cc')
-rw-r--r--gold/options.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/gold/options.cc b/gold/options.cc
index 78e14dcd30..0844d53ed6 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -403,7 +403,7 @@ General_options::parse_end_group(const char*, const char*,
}
// The function add_excluded_libs() in ld/ldlang.c of GNU ld breaks up a list
-// of names seperated by commas or semi-colons and puts them in a linked list.
+// of names seperated by commas or colons and puts them in a linked list.
// We implement the same parsing of names here but store names in an unordered
// map to speed up searching of names.
@@ -444,18 +444,21 @@ General_options::check_excluded_libs (const std::string &name) const
if (p != excluded_libs_.end())
return true;
+ // First strip off any directories in name.
+ const char *basename = lbasename(name.c_str());
+
// Try finding an exact match.
- p = excluded_libs_.find(name);
+ p = excluded_libs_.find(std::string(basename));
if (p != excluded_libs_.end())
return true;
// Try matching NAME without ".a" at the end.
- size_t length = name.length();
+ size_t length = strlen(basename);
if ((length >= 2)
- && (name[length-2] == '.')
- && (name[length-1] == 'a'))
+ && (basename[length - 2] == '.')
+ && (basename[length - 1] == 'a'))
{
- p = excluded_libs_.find(name.substr(0, length - 2));
+ p = excluded_libs_.find(std::string(basename, length - 2));
if (p != excluded_libs_.end())
return true;
}