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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Mark Mitchell from comment #3)
> For what it's worth, and without knowledge of the Solaris linker, I agree
> that the code in the Solaris linker seems to be unecessary.  I don't see
> anything wrong with the symbols as they currently stand.
> 
> It seems slightly undesirable to me to make them global hidden simply
> because that does mean that the linker will "see" them outside of the object
> file where they are defined, and that just seems messy.

obj-elf.c has

      if (!sy 
          || (sy != symbol_lastP
              && (sy->sy_next == NULL 
                  || sy->sy_next->sy_previous != sy)))
        {
          /* Create the symbol now.  */
          sy = symbol_new (group_name, now_seg, (valueT) 0, frag_now);
#ifdef TE_SOLARIS
          /* Before Solaris 11 build 154, Sun ld rejects local group
             signature symbols, so make them weak hidden instead.  */
          symbol_get_bfdsym (sy)->flags |= BSF_WEAK;
          S_SET_OTHER (sy, STV_HIDDEN);
#else
          symbol_get_obj (sy)->local = 1; 
#endif
          symbol_table_insert (sy);

This is wrong:

[hjl@gnu-tools-1 ld]$ cat x.s
        .text
        .global xxx
xxx:
        call foo
[hjl@gnu-tools-1 ld]$ cat y.s
        .section        .text.foo,"Gx",%progbits,foo,comdat
        .text
        .global bar
bar:
        call xxx
[hjl@gnu-tools-1 ld]$ ../gas/as-new -o x.o x.s
[hjl@gnu-tools-1 ld]$ ../gas/as-new -o y.o y.s
[hjl@gnu-tools-1 ld]$ readelf -sW x.o | grep foo
     5: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND foo
[hjl@gnu-tools-1 ld]$ readelf -sW y.o | grep foo
     8: 0000000000000000     0 NOTYPE  WEAK   HIDDEN     1 foo
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  foo shouldn't be weak and
hidden.
[hjl@gnu-tools-1 ld]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to