aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2009-05-19 22:14:17 +0000
committerCary Coutant <ccoutant@google.com>2009-05-19 22:14:17 +0000
commit6551490093fe8f141c073324b2c4387ce93fa712 (patch)
treec35b9675ce37ee8303e3c60cc04b57b78beed857 /gold/symtab.cc
parentc1711530e652a14bc0df9b603c73e350b5dfe5ec (diff)
downloadgdb-6551490093fe8f141c073324b2c4387ce93fa712.zip
gdb-6551490093fe8f141c073324b2c4387ce93fa712.tar.gz
gdb-6551490093fe8f141c073324b2c4387ce93fa712.tar.bz2
2009-05-19 Doug Kwan <dougkwan@google.com>
* archive.cc (Archive::Archive): Move constructor from archive.h to here. Initialize no_export_. (Archive::get_elf_object_for_member): Set no_export flag of object. * archive.h (Archive::Archive): Move constructor body to archive.cc. (Archive::no_export): New method. (Archive::no_export_): New field. * object.h (Object::Object): Initialize no_export_ to false. (Object::no_export, Object::set_no_export): New methods. (Object::no_export_): New field. * options.cc (General_options::parse_exclude_libs): New method. (General_options::check_excluded_libs) Same. * options.h (exclude_libs): New option. (General_options::check_excluded_libs): New method declaration. (General_options::excluded_libs_): New field. * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with default or protected visibility if an object has no-export flag set. testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test. (check_SCRIPTS): Add exclude_libs_test.sh. (check_DATA): Add exclude_libs_test.syms. (MOSTLYCLEANFILES): Add exclude_libs_test.syms, libexclude_libs_test_1.a and libexclude_libs_test_2.a. (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES, exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define. (exclude_libs_test.syms, libexclude_libs_test_1.a, libexclude_libs_test_2.a): New rules. * testsuite/Makefile.in: Regenerate. * testsuite/exclude_libs_test.c: New file. * testsuite/exclude_libs_test.sh: Ditto. * testsuite/exclude_libs_test_1.c: Ditto. * testsuite/exclude_libs_test_2.c: Ditto.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 30e7d10..3d179ef 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -1126,6 +1126,26 @@ Symbol_table::add_from_relobj(
psym = &sym2;
}
+ // Fix up visibility if object has no-export set.
+ if (relobj->no_export())
+ {
+ // We may have copied symbol already above.
+ if (psym != &sym2)
+ {
+ memcpy(symbuf, p, sym_size);
+ psym = &sym2;
+ }
+
+ elfcpp::STV visibility = sym2.get_st_visibility();
+ if (visibility == elfcpp::STV_DEFAULT
+ || visibility == elfcpp::STV_PROTECTED)
+ {
+ elfcpp::Sym_write<size, big_endian> sw(symbuf);
+ unsigned char nonvis = sym2.get_st_nonvis();
+ sw.put_st_other(elfcpp::STV_HIDDEN, nonvis);
+ }
+ }
+
Stringpool::Key name_key;
name = this->namepool_.add_with_length(name, namelen, true,
&name_key);