bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/12181] local COMDAT group names break linking libstdc++.so with


From: ro at CeBiTec dot Uni-Bielefeld.DE
Subject: [Bug gas/12181] local COMDAT group names break linking libstdc++.so with Sun ld
Date: Fri, 5 Nov 2010 17:28:54 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12181

--- Comment #1 from Rainer Orth <ro at CeBiTec dot Uni-Bielefeld.DE> 2010-11-05 
17:28:24 UTC ---
Parallel to filing this PR, I've contacted the Solaris linker
maintainers.  Here's Ali Bahrami's analysis, cited by permission:

----------------------------------------------------------------------------

   The error you reported in the bugzilla report

        ld: fatal: file group.o: group section [1].group: invalid group symbol
D5Ev

comes from this code in groups.c:


    /*
     * If this group is a COMDAT group, validate the signature symbol.
     */
    if ((gd.gd_data[0] & GRP_COMDAT) && !gnu_stt_section &&
        ((ELF_ST_BIND(sym->st_info) == STB_LOCAL) ||
        (sym->st_shndx == SHN_UNDEF))) {
        /* If section symbol, construct a printable name for it */
        if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) {
            if (gisc->is_sym_name == NULL)
                (void) ld_stt_section_sym_name(gisc);

            if (gisc->is_sym_name != NULL)
                str = gisc->is_sym_name;
        }

        ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_GRP_INVALSYM),
            gifl->ifl_name, EC_WORD(gisc->is_scnndx),
            gisc->is_name, str);
        return (0);
    }

As you deduced, it does not like the fact that the name symbol is local.

I can guess at the cause of this. The LLM says this in the documentation for
"Group Section" in the "File Format" chapter:

        References to the sections comprising a group from sections outside
        of the group must be made through symbol table entries with STB_GLOBAL
        or STB_WEAK binding and section index SHN_UNDEF. A definition of the
        same symbol in the object containing the reference must have a separate
        symbol table entry from the reference. Sections outside of the group
        can not reference symbols with STB_LOCAL binding for addresses that
        are contained in the group's sections, including symbols with type
        STT_SECTION.

As far as I can tell, the symbol that gives a group its name is not
a "reference to the sections comprising a group". In fact, it seems that
we take the name for the group from this symbol and then never look
at the symbol again (at least as far as the group is concerned). As such,
I don't know why the symbol's type, scope, binding, or any other attribute
would matter. Perhaps this wording, which is clearly about how the code within
a group can be accessed by code outside the group, led us to assume that the
name symbol needs to be global.

I note in the above code that we also refuse to let the symbol be undefined,
even if it has a valid name. I don't really understand why that's not
allowed either --- as long as it has a name we can use for the group, what
does it matter? This makes me think that the entire block of code shown above
could simply come out.

----------------------------------------------------------------------------

If you can confirm this analysis, the issue could be fixed on the
Solaris ld side.

Additionally, it might be possible (not yet tried, just an idea) to
change the STB_GLOBAL, but use STV_HIDDEN.  This would have the same
effect as making it local in the first place, but avoid the Solaris ld
problem even for current versions.

Comments?

    Rainer

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]