diff options
author | Ian Lance Taylor <ian@airs.com> | 2010-01-12 19:12:40 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2010-01-12 19:12:40 +0000 |
commit | 837504c42dbf7cb67ee328fb0bdf594b70c90209 (patch) | |
tree | 2547bf31529721438775d6b81af928ee62003799 /gold/target-reloc.h | |
parent | d30c5336898cf78fd1017216ffb2f8f26b22cc02 (diff) | |
download | gdb-837504c42dbf7cb67ee328fb0bdf594b70c90209.zip gdb-837504c42dbf7cb67ee328fb0bdf594b70c90209.tar.gz gdb-837504c42dbf7cb67ee328fb0bdf594b70c90209.tar.bz2 |
* target-reloc.h (visibility_error): New inline function.
(relocate_section): Call visibility_error.
* testsuite/Makefile.am (check_DATA): Add protected_3.err.
(MOSTLYCLEANFILES): Likewise.
(protected_4_pic.o, protected_3.err): New targets.
* testsuite/protected_4.cc: New file.
Diffstat (limited to 'gold/target-reloc.h')
-rw-r--r-- | gold/target-reloc.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gold/target-reloc.h b/gold/target-reloc.h index 06597e2..4cb3315 100644 --- a/gold/target-reloc.h +++ b/gold/target-reloc.h @@ -144,6 +144,31 @@ get_comdat_behavior(const char* name) return CB_WARNING; } +// Give an error for a symbol with non-default visibility which is not +// defined locally. + +inline void +visibility_error(const Symbol* sym) +{ + const char* v; + switch (sym->visibility()) + { + case elfcpp::STV_INTERNAL: + v = _("internal"); + break; + case elfcpp::STV_HIDDEN: + v = _("hidden"); + break; + case elfcpp::STV_PROTECTED: + v = _("protected"); + break; + default: + gold_unreachable(); + } + gold_error(_("%s symbol '%s' is not defined locally"), + v, sym->name()); +} + // This function implements the generic part of relocation processing. // The template parameter Relocate must be a class type which provides // a single function, relocate(), which implements the machine @@ -323,6 +348,10 @@ relocate_section( && (!parameters->options().shared() // -shared || parameters->options().defs())) // -z defs gold_undefined_symbol_at_location(sym, relinfo, i, offset); + else if (sym != NULL + && sym->visibility() != elfcpp::STV_DEFAULT + && (sym->is_undefined() || sym->is_from_dynobj())) + visibility_error(sym); if (sym != NULL && sym->has_warning()) relinfo->symtab->issue_warning(sym, relinfo, i, offset); |