diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-04-21 05:33:04 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-04-21 05:33:17 -0700 |
commit | 6914be53bd662eefd979d0c82d2e20e108c4ee66 (patch) | |
tree | 1ae1bebd08fc216bb92d2deb38e21408776a1f87 /gas/doc | |
parent | 6f6fd151cbf226bbaa66e44977f57b7c6dc33d89 (diff) | |
download | gdb-6914be53bd662eefd979d0c82d2e20e108c4ee66.zip gdb-6914be53bd662eefd979d0c82d2e20e108c4ee66.tar.gz gdb-6914be53bd662eefd979d0c82d2e20e108c4ee66.tar.bz2 |
gas: Extend .symver directive
Extend .symver directive to update visibility of the original symbol and
assign one original symbol to different versioned symbols:
.symver foo, foo@VERS_1, local # Change foo to a local symbol.
.symver foo, foo@VERS_2, hidden # Change foo to a hidden symbol.
.symver foo, foo@@VERS_3, remove # Remove foo from symbol table.
.symver foo, bar@V1 # Assign foo to bar@V1 and baz@V2.
.symver foo, baz@V2
PR gas/23840
PR gas/25295
* NEWS: Mention .symver extension.
* config/obj-elf.c (obj_elf_find_and_add_versioned_name): New
function.
(obj_elf_symver): Call obj_elf_find_and_add_versioned_name to
add a version name. Add local, hidden and remove visibility
support.
(elf_frob_symbol): Handle the list of version names. Update the
original symbol to local, hidden or remove it from the symbol
table.
(elf_frob_file_before_adjust): Handle the list of version names.
* config/obj-elf.h (elf_visibility): New.
(elf_versioned_name_list): Likewise.
(elf_obj_sy): Change local to bitfield. Add rename, bad_version
and visibility. Change versioned_name pointer to struct
elf_versioned_name_list.
* doc/as.texi: Update .symver directive.
* testsuite/gas/symver/symver.exp: Run all *.d tests. Add more
error checking tests.
* testsuite/gas/symver/symver6.d: New file.
* testsuite/gas/symver/symver7.d: Likewise.
* testsuite/gas/symver/symver7.s: Likewise.
* testsuite/gas/symver/symver8.d: Likewise.
* testsuite/gas/symver/symver8.s: Likewise.
* testsuite/gas/symver/symver9.s: Likewise.
* testsuite/gas/symver/symver9a.d: Likewise.
* testsuite/gas/symver/symver9b.d: Likewise.
* testsuite/gas/symver/symver10.s: Likewise.
* testsuite/gas/symver/symver10a.d: Likewise.
* testsuite/gas/symver/symver10b.d: Likewise.
* testsuite/gas/symver/symver11.d: Likewise.
* testsuite/gas/symver/symver11.s: Likewise.
* testsuite/gas/symver/symver12.d: Likewise.
* testsuite/gas/symver/symver12.s: Likewise.
* testsuite/gas/symver/symver13.d: Likewise.
* testsuite/gas/symver/symver13.s: Likewise.
* testsuite/gas/symver/symver14.d: Likewise.
* testsuite/gas/symver/symver14.l: Likewise.
* testsuite/gas/symver/symver15.d: Likewise.
* testsuite/gas/symver/symver15.l: Likewise.
* testsuite/gas/symver/symver6.l: Removed.
* testsuite/gas/symver/symver6.s: Updated.
Diffstat (limited to 'gas/doc')
-rw-r--r-- | gas/doc/as.texi | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gas/doc/as.texi b/gas/doc/as.texi index 0a6727e..8669879 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -4509,7 +4509,7 @@ Some machine configurations provide additional directives. * Struct:: @code{.struct @var{expression}} @ifset ELF * SubSection:: @code{.subsection} -* Symver:: @code{.symver @var{name},@var{name2@@nodename}} +* Symver:: @code{.symver @var{name},@var{name2@@nodename}[,@var{visibility}]} @end ifset @ifset COFF @@ -7112,9 +7112,9 @@ shared library. For ELF targets, the @code{.symver} directive can be used like this: @smallexample -.symver @var{name}, @var{name2@@nodename} +.symver @var{name}, @var{name2@@nodename}[ ,@var{visibility}] @end smallexample -If the symbol @var{name} is defined within the file +If the original symbol @var{name} is defined within the file being assembled, the @code{.symver} directive effectively creates a symbol alias with the name @var{name2@@nodename}, and in fact the main reason that we just don't try and create a regular alias is that the @var{@@} character isn't @@ -7127,7 +7127,15 @@ function is being mentioned. The @var{nodename} portion of the alias should be the name of a node specified in the version script supplied to the linker when building a shared library. If you are attempting to override a versioned symbol from a shared library, then @var{nodename} should correspond to the -nodename of the symbol you are trying to override. +nodename of the symbol you are trying to override. The optional argument +@var{visibility} updates the visibility of the original symbol. The valid +visibilities are @code{local}, @code {hidden}, and @code {remove}. The +@code{local} visibility makes the original symbol a local symbol +(@pxref{Local}). The @code{hidden} visibility sets the visibility of the +original symbol to @code{hidden} (@pxref{Hidden}). The @code{remove} +visibility removes the original symbol from the symbol table if it isn't +used in relocation. If visibility isn't specified, the original symbol +is unchanged. If the symbol @var{name} is not defined within the file being assembled, all references to @var{name} will be changed to @var{name2@@nodename}. If no |