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

--- Comment #20 from Ali Bahrami <ali_swbugzilla at emvision dot com> ---
Yes, I see the same text in the Solaris <sys/link.h>,
and I agree that it is confusing:

    /*                                                                          
     * Versym symbol index values.  Values greater than VER_NDX_GLOBAL          
     * and less then VER_NDX_LORESERVE associate symbols with user              
     * specified version descriptors.                                           
     */
    #define VER_NDX_LOCAL       0       /* symbol is local */
    #define VER_NDX_GLOBAL      1       /* symbol is global and assigned to */
                                        /*      the base version */
    #define VER_NDX_LORESERVE   0xff00  /* beginning of RESERVED entries */
    #define VER_NDX_ELIMINATE   0xff01  /* symbol is to be eliminated */

Before replying, I went into our records to find the
original PSARC case that created Sun's implementation
from 1994. It's evident that the authors expected that
only local symbols would be in version index 0. The
notes from then are nearly 1:1 with what's in the current
Solaris Linker and Libraries manual.

The case we've been discussing, of an undefined global
symbol in a final object, is really unusual, because normally
you'd be unable to link such an object without getting an
unsatisfied symbol error that would fail the link. Remember
that we had to use a weak reference symbol in order to make
it happen. That's very artificial, I think it's safe to
say that it doesn't really happen in useful code, and is
just a weird corner case.

As such, I think it's fair to say that the original authors
weren't thinking about the scenario we've been discussing
at all, hence the naming they used. However, the fact that
index 0 is the only valid index for these weird unsatisfied
globals follows from the way these data structures are defined.
Supporting that is the fact that it matches what the Solaris
link-editor does, and that code is also largely unchanged from
1994. A local symbol will always have a version index of 0,
but a version index of 0 does not always imply a local symbol.
Just 99+% of the time.

Given how obscure this is, I think the name VER_NDX_LOCAL
is OK, if not perfect. Not worth trying to change now, but
something to be aware of.

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

Reply via email to