This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Avoid link error with Solaris ld and local COMDAT group signature symbols (PR gas/12181)
Alan Modra <amodra@gmail.com> writes:
> On Mon, Nov 15, 2010 at 08:48:33PM +0100, Rainer Orth wrote:
>> + /* Before Solaris 11 build 154, Sun ld rejects local group
>> + signature symbols, so make them global hidden instead. */
>> + symbol_get_bfdsym (sy)->flags |= BSF_OBJECT | BSF_GLOBAL;
>> + S_SET_OTHER (sy, STV_HIDDEN);
>
> It occurs to me that making the symbol BSF_GLOBAL may cause link
> errors. BSF_WEAK would be better, assuming that the Solaris linker
> likes that.
Works just as well, both for the testcase and GCC. I've just
successfully bootstrapped GCC mainline on i386-pc-solaris2.11 with the
patch below. I've omitted the BSF_OBJECT part since the non-Solaris
cases produced symbols with NOTYPE as well and it works fine this way.
Ok for mainline and 2.21 branch now?
Thanks.
Rainer
2010-11-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gas:
PR gas/12181
* config/obj-elf.c (elf_adjust_symtab) [TE_SOLARIS]: Make sy
weak hidden.
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 8eb66ed..c6dc8d6 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -2142,7 +2142,14 @@ elf_adjust_symtab (void)
{
/* 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);
}
elf_group_id (s) = symbol_get_bfdsym (sy);
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University