diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2005-10-24 17:51:42 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2005-10-24 17:51:42 +0000 |
commit | 06e77878ef2b6a57ef92c1691b3aeb668dc248ba (patch) | |
tree | 5bb8d868d5530589690a1e248422257110dea2b3 /gas/doc | |
parent | 9ba4c445137e7c387090441e2837e09479f14457 (diff) | |
download | gdb-06e77878ef2b6a57ef92c1691b3aeb668dc248ba.zip gdb-06e77878ef2b6a57ef92c1691b3aeb668dc248ba.tar.gz gdb-06e77878ef2b6a57ef92c1691b3aeb668dc248ba.tar.bz2 |
gas/ChangeLog:
* read.c (potable): Add weakref.
(s_weakref): New.
* read.h (s_weakref): Declare.
* struc-symbol.h (struct symbol): Add sy_weakrefr and sy_weakrefd.
* symbols.c (colon): Clear weakrefr.
(symbol_find_exact): Rename to, and reimplement in terms of...
(symbol_find_exact_noref): ... new function.
(symbol_find): Likewise...
(symbol_find_noref): ... ditto.
(resolve_symbol_value): Resolve weakrefr without setting their
values.
(S_SET_WEAK): Call hook.
(S_GET_VALUE): Follow weakref link.
(S_SET_VALUE): Clear weakrefr.
(S_IS_WEAK): Follow weakref link.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): New.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): New.
(symbol_set_value_expression, symbol_set_frag): Clear weakrefr.
(symbol_mark_used): Follow weakref link.
(print_symbol_value_1): Print weak, weakrefr and weakrefd.
* symbols.h (symbol_find_noref, symbol_find_exact_noref): Declare.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): Declare.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): Declare.
* write.c (adust_reloc_syms): Follow weakref link. Do not
complain if target is undefined.
(write_object_file): Likewise. Remove weakrefr symbols. Drop
unreferenced weakrefd symbols.
* config/obj-coff.c (obj_frob_symbol): Do not force WEAKREFD
symbols EXTERNAL.
(pecoff_obj_set_weak_hook, pecoff_obj_clear_weak_hook): New.
* config/obj-coff.h (obj_set_weak_hook, obj_clear_weak_hook): Define.
* doc/as.texinfo: Document weakref.
* doc/internals.texi: Document new struct members, internal
functions and hooks.
gas/testsuite/ChangeLog:
* gas/all/weakref1.s, gas/all/weakref1.d: New test.
* gas/all/weakref1g.d, gas/all/weakref1l.d: New tests.
* gas/all/weakref1u.d, gas/all/weakref1w.d: New tests.
* gas/all/weakref2.s, gas/all/weakref3.s: New tests.
* gas/all/gas.exp: Run new tests.
Diffstat (limited to 'gas/doc')
-rw-r--r-- | gas/doc/as.texinfo | 20 | ||||
-rw-r--r-- | gas/doc/internals.texi | 52 |
2 files changed, 71 insertions, 1 deletions
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index c7c2ac7..4eefc42 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -3842,6 +3842,7 @@ Some machine configurations provide additional directives. * Warning:: @code{.warning @var{string}} * Weak:: @code{.weak @var{names}} +* Weakref:: @code{.weakref @var{alias}, @var{symbol}} * Word:: @code{.word @var{expressions}} * Deprecated:: Deprecated Directives @end menu @@ -5989,6 +5990,25 @@ On the PE target, weak symbols are supported natively as weak aliases. When a weak symbol is created that is not an alias, GAS creates an alternate symbol to hold the default value. +@node Weakref +@section @code{.weakref @var{alias}, @var{target}} + +@cindex @code{weakref} directive +This directive creates an alias to the target symbol that enables the symbol to +be referenced with weak-symbol semantics, but without actually making it weak. +If direct references or definitions of the symbol are present, then the symbol +will not be weak, but if all references to it are through weak references, the +symbol will be marked as weak in the symbol table. + +The effect is equivalent to moving all references to the alias to a separate +assembly source file, renaming the alias to the symbol in it, declaring the +symbol as weak there, and running a reloadable link to merge the object files +resulting from the assembly of the new source file and the old source file that +had the references to the alias removed. + +The alias itself never makes to the symbol table, and is entirely handled +within the assembler. + @node Word @section @code{.word @var{expressions}} diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 8c8c66e..51b4061 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -93,6 +93,13 @@ responsible for setting it when a symbol is used in backend routines. Whether the symbol is an MRI common symbol created by the @code{COMMON} pseudo-op when assembling in MRI mode. +@item sy_weakrefr +Whether the symbol is a @code{weakref} alias to another symbol. + +@item sy_weakrefd +Whether the symbol is or was referenced by one or more @code{weakref} aliases, +and has not had any direct references. + @item bsym This points to the BFD @code{asymbol} that will be used in writing the object file. @@ -146,7 +153,17 @@ A synonym for @code{S_IS_EXTERNAL}. Don't use it. @item S_IS_WEAK @cindex S_IS_WEAK -Return non-zero if the symbol is weak. +Return non-zero if the symbol is weak, or if it is a @code{weakref} alias or +symbol that has not been strongly referenced. + +@item S_IS_WEAKREFR +@cindex S_IS_WEAKREFR +Return non-zero if the symbol is a @code{weakref} alias. + +@item S_IS_WEAKREFD +@cindex S_IS_WEAKREFD +Return non-zero if the symbol was aliased by a @code{weakref} alias and has not +had any strong references. @item S_IS_COMMON @cindex S_IS_COMMON @@ -182,6 +199,29 @@ Mark the symbol as not externally visible. @cindex S_SET_WEAK Mark the symbol as weak. +@item S_SET_WEAKREFR +@cindex S_SET_WEAKREFR +Mark the symbol as the referrer in a @code{weakref} directive. The symbol it +aliases must have been set to the value expression before this point. If the +alias has already been used, the symbol is marked as used too. + +@item S_CLEAR_WEAKREFR +@cindex S_CLEAR_WEAKREFR +Clear the @code{weakref} alias status of a symbol. This is implicitly called +whenever a symbol is defined or set to a new expression. + +@item S_SET_WEAKREFD +@cindex S_SET_WEAKREFD +Mark the symbol as the referred symbol in a @code{weakref} directive. +Implicitly marks the symbol as weak, but see below. It should only be called +if the referenced symbol has just been added to the symbol table. + +@item S_SET_WEAKREFD +@cindex S_SET_WEAKREFD +Clear the @code{weakref} aliased status of a symbol. This is implicitly called +whenever the symbol is looked up, as part of a direct reference or a +definition, but not as part of a @code{weakref} directive. + @item S_GET_TYPE @item S_GET_DESC @item S_GET_OTHER @@ -1533,6 +1573,16 @@ If you define this macro, GAS will call it for each symbol. You can indicate that the symbol should not be included in the object file by defining this macro to set its second argument to a non-zero value. +@item obj_set_weak_hook +@cindex obj_set_weak_hook +If you define this macro, @code{S_SET_WEAK} will call it before modifying the +symbol's flags. + +@item obj_clear_weak_hook +@cindex obj_clear_weak_hook +If you define this macro, @code{S_CLEAR_WEAKREFD} will call it after clearning +the @code{weakrefd} flag, but before modifying any other flags. + @item obj_frob_file @cindex obj_frob_file If you define this macro, GAS will call it after the symbol table has been |