https://sourceware.org/bugzilla/show_bug.cgi?id=33577

--- Comment #5 from Ali Bahrami <ali_swbugzilla at emvision dot com> ---
I don't think this is specifically a Solaris issue, but rather,
just one that was noticed on Solaris by virtue of comparing objects
from the two link-editors.

My understanding of versioning:

    - Versioned symbols defined by the object (definitions) are associated
      with a VERDEF record.

    - Versioned symbols that are defined externally by some other object
      (references) are associated with a VERNEED record.

    - Symbols that are not versioned are given version index 0. These can
      be either definitions, or external references.

    - The BASE version, which has index 1, is the version that holds the
      symbols defined by the object itself, that have not otherwise been 
      assigned to a different version, possibly with a linker script.
      By convention, the version is given the SONAME of the object. This
      is a VERDEF, so external references don't belong here.

    - Named versions, first VERDEF, and then VERNEED, are given indexes
      starting at 2.

So in this example, we have the following versions:

    % elfdump -v a.out

    Version Definition Section:  .gnu.version_d
      index  version    dependency
        [1]  a.out                  [ BASE ]
        [2]  VERS_1     

    Version Needed Section:  .gnu.version_r
      index  file       version   
        [3]  libc.so.1  SUNW_0.7

Or summarizing:

    [0] Not versioned
    [1] BASE definitions
    [2] Definitions assigned to version VERS_1 by the linker script
    [3] External Symbols identified as coming from version SUNW_0.7 in libc

The problem then, is that show_undef_weak is an external reference,
not a definition, so it should not be assigned to any VERDEF (BASE,
or otherwise). The valid options would be version index 0 (not versioned),
or the index of a VERNEED record.

As you pointed out earlier, we have no information that would identify
such a VERNEED. The source of this symbol, if it even exists, is
completely unknown to the link-edit, so it has no version, and version
index 0 is the appropriate assignment for it.

I believe that these details are the same on Solaris as on GNU. I also
don't think it's causing any known problems today, as the example is  
artificial, and the approach using a weak symbol is poor. It's just
something  that was noticed while testing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to