+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
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));
{"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},
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;
* 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}}
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}}