<html lang="en"> <head> <title>Symver - Using as</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Using as"> <meta name="generator" content="makeinfo 4.7"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Pseudo-Ops.html#Pseudo-Ops" title="Pseudo Ops"> <link rel="prev" href="SubSection.html#SubSection" title="SubSection"> <link rel="next" href="Tag.html#Tag" title="Tag"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This file documents the GNU Assembler "as". Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002, 2006, 2007 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. man end--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family: serif; font-weight: normal; } --></style> </head> <body> <div class="node"> <p> <a name="Symver"></a>Next: <a rel="next" accesskey="n" href="Tag.html#Tag">Tag</a>, Previous: <a rel="previous" accesskey="p" href="SubSection.html#SubSection">SubSection</a>, Up: <a rel="up" accesskey="u" href="Pseudo-Ops.html#Pseudo-Ops">Pseudo Ops</a> <hr><br> </div> <h3 class="section">7.107 <code>.symver</code></h3> <p><a name="index-_0040code_007bsymver_007d-directive-474"></a><a name="index-symbol-versioning-475"></a><a name="index-versions-of-symbols-476"></a>Use the <code>.symver</code> directive to bind symbols to specific version nodes within a source file. This is only supported on ELF platforms, and is typically used when assembling files to be linked into a shared library. There are cases where it may make sense to use this in objects to be bound into an application itself so as to override a versioned symbol from a shared library. <p>For ELF targets, the <code>.symver</code> directive can be used like this: <pre class="smallexample"> .symver <var>name</var>, <var>name2@nodename</var> </pre> <p>If the symbol <var>name</var> is defined within the file being assembled, the <code>.symver</code> directive effectively creates a symbol alias with the name <var>name2@nodename</var>, and in fact the main reason that we just don't try and create a regular alias is that the <var>@</var> character isn't permitted in symbol names. The <var>name2</var> part of the name is the actual name of the symbol by which it will be externally referenced. The name <var>name</var> itself is merely a name of convenience that is used so that it is possible to have definitions for multiple versions of a function within a single source file, and so that the compiler can unambiguously know which version of a function is being mentioned. The <var>nodename</var> 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</var> should correspond to the nodename of the symbol you are trying to override. <p>If the symbol <var>name</var> is not defined within the file being assembled, all references to <var>name</var> will be changed to <var>name2@nodename</var>. If no reference to <var>name</var> is made, <var>name2@nodename</var> will be removed from the symbol table. <p>Another usage of the <code>.symver</code> directive is: <pre class="smallexample"> .symver <var>name</var>, <var>name2@@nodename</var> </pre> <p>In this case, the symbol <var>name</var> must exist and be defined within the file being assembled. It is similar to <var>name2@nodename</var>. The difference is <var>name2@@nodename</var> will also be used to resolve references to <var>name2</var> by the linker. <p>The third usage of the <code>.symver</code> directive is: <pre class="smallexample"> .symver <var>name</var>, <var>name2@@@nodename</var> </pre> <p>When <var>name</var> is not defined within the file being assembled, it is treated as <var>name2@nodename</var>. When <var>name</var> is defined within the file being assembled, the symbol name, <var>name</var>, will be changed to <var>name2@@nodename</var>. </body></html>