aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-01-03 18:34:24 +0000
committerNick Clifton <nickc@redhat.com>2000-01-03 18:34:24 +0000
commit2e13b764859730a6bf359cd73b7e7acd4d95e071 (patch)
treec25da3c0c3ee5c438aeeae100b149e1598232980 /gas
parent7a13edea08cb46d90e1512c72540de7d0b1411a5 (diff)
downloadgdb-2e13b764859730a6bf359cd73b7e7acd4d95e071.zip
gdb-2e13b764859730a6bf359cd73b7e7acd4d95e071.tar.gz
gdb-2e13b764859730a6bf359cd73b7e7acd4d95e071.tar.bz2
ELF visibility patch from Martin Loewis
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/obj-elf.c48
-rw-r--r--gas/doc/as.texinfo37
3 files changed, 93 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e9ad534..9e73705 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2000-01-03 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+
+ * config/obj-elf.c (elf_pseudo_table): Define visibility pseudos.
+ (obj_elf_visibility): New function.
+
+ * doc/as.texinfo (Visibility): New node: document visibility
+ pseudo ops.
+
1999-12-27 Alan Modra <alan@spri.levels.unisa.edu.au>
* config/tc-i386.c (MATCH): Relax JumpAbsolute check. Emit a
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 29402eb..4fbd8bc 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -65,6 +65,7 @@ static void obj_elf_type PARAMS ((int));
static void obj_elf_ident PARAMS ((int));
static void obj_elf_weak PARAMS ((int));
static void obj_elf_local PARAMS ((int));
+static void obj_elf_visibility PARAMS ((int));
static void obj_elf_symver PARAMS ((int));
static void obj_elf_vtable_inherit PARAMS ((int));
static void obj_elf_vtable_entry PARAMS ((int));
@@ -89,6 +90,11 @@ static const pseudo_typeS elf_pseudo_table[] =
{"version", obj_elf_version, 0},
{"weak", obj_elf_weak, 0},
+ /* These define symbol visibility. */
+ {"internal", obj_elf_visibility, STV_INTERNAL},
+ {"hidden", obj_elf_visibility, STV_HIDDEN},
+ {"protected", obj_elf_visibility, STV_PROTECTED},
+
/* These are used for stabs-in-elf configurations. */
{"line", obj_elf_line, 0},
@@ -474,6 +480,48 @@ obj_elf_weak (ignore)
demand_empty_rest_of_line ();
}
+static void
+obj_elf_visibility (visibility)
+ int visibility;
+{
+ char *name;
+ int c;
+ symbolS *symbolP;
+ asymbol *bfdsym;
+ elf_symbol_type *elfsym;
+
+ do
+ {
+ name = input_line_pointer;
+ c = get_symbol_end ();
+ symbolP = symbol_find_or_make (name);
+ *input_line_pointer = c;
+
+ SKIP_WHITESPACE ();
+
+ bfdsym = symbol_get_bfdsym (symbolP);
+ elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
+
+ assert (elfsym);
+
+ elfsym->internal_elf_sym.st_other = visibility;
+
+ if (c == ',')
+ {
+ input_line_pointer ++;
+
+ SKIP_WHITESPACE ();
+
+ if (*input_line_pointer == '\n')
+ c = '\n';
+ }
+ }
+ while (c == ',');
+
+ demand_empty_rest_of_line ();
+}
+
+
static segT previous_section;
static int previous_subsection;
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index 330a8b2..eb5aee8 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -3195,6 +3195,9 @@ Some machine configurations provide additional directives.
* Type:: @code{.type @var{int}}
* Val:: @code{.val @var{addr}}
@end ifset
+@ifset ELF
+* Visibility:: @code{.internal @var{name}, .hidden @var{name}, .protected @var{name}}
+@end ifset
* Uleb128:: @code{.uleb128 @var{expressions}}
* Word:: @code{.word @var{expressions}}
@@ -4756,6 +4759,40 @@ configured for @code{b.out}, it accepts this directive but ignores it.
compact, variable length representation of numbers used by the DWARF
symbolic debugging format. @xref{Sleb128,@code{.sleb128}}.
+@ifset ELF
+@node Visibility
+@section @code{.internal}, @code{.hidden}, @code{.protected}
+@cindex @code{internal} directive
+@cindex @code{hidden} directive
+@cindex @code{protected} directive
+@cindex symbol visibility
+
+These directives can be used to set the visibility of a specified symbol. By
+default a symbol's visibility is set by its binding (local, global or weak),
+but these directives can be used to override that.
+
+A visibility of @code{protected} means that any references to the symbol from
+within the component that defines the symbol must be resolved to the definition
+in that component, even if a definition in another component would normally
+preempt this.
+
+A visibility of @code{hidden} means that the symbol is not visible to other
+components. Such a symbol is always considered to be protected as well.
+
+A visibility of @code{internal} is the same as a visibility of @code{hidden},
+except that some extra, processor specific processing must also be performed
+upon the symbol.
+
+For ELF targets, the directives are used like this:
+
+@smallexample
+.internal @var{name}
+.hidden @var{name}
+.protected @var{name}
+@end smallexample
+
+@end ifset
+
@node Word
@section @code{.word @var{expressions}}