From patchwork Wed Jan 5 17:12:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 77617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 94E3DB7088 for ; Thu, 6 Jan 2011 04:12:36 +1100 (EST) Received: (qmail 17528 invoked by alias); 5 Jan 2011 17:12:32 -0000 Received: (qmail 17517 invoked by uid 22791); 5 Jan 2011 17:12:31 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Jan 2011 17:12:27 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 95F5D16 for ; Wed, 5 Jan 2011 18:12:24 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id nYWsjbUPRVjy for ; Wed, 5 Jan 2011 18:12:22 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id F058F15 for ; Wed, 5 Jan 2011 18:12:21 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p05HCLo8017120; Wed, 5 Jan 2011 18:12:21 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: Switch to .bss from .tdata on Solaris 2 (PR target/38118) Date: Wed, 05 Jan 2011 18:12:21 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org There is a single remaining objc failure on Solaris 2/x86 (both 32 and 64-bit), which only occurs if using Sun as instead of gas: FAIL: objc.dg/torture/tls/thr-init-3.m -O2 -fwhopr (test for excess errors) WARNING: objc.dg/torture/tls/thr-init-3.m -O2 -fwhopr compilation failed to p roduce executable Excess errors: ld: warning: symbol '_OBJC_CLASS_NAME_3.2113.2105' has invalid section index; ignored: (file /var/tmp//ccqjayQH.ltrans0.ltrans.o value=COMMON); ld: fatal: relocation error: R_386_32: file /var/tmp//ccqjayQH.ltrans0.ltrans.o: section [12].rel.data: attempt to relocate with respect to unknown symbol _OBJC_CLASS_NAME_3.2113.2105: offset 0x10, symbol index 13 This turned out to be another instance of PR target/38118: with as, the symbol is created as [14] | 0| 1|TLS |LOCL |0 |COMMON |_OBJC_CLASS_NAME_3.2072.2064 while with gas, one gets [16] | 0| 1|OBJT |LOCL |0 |5 |_OBJC_CLASS_NAME_3.2072.2064 A similar bug has been fixed ages ago: 2004-06-14 Jakub Jelinek PR target/15178 * config/i386/sol2.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. but that only handled coming from .tbss, while here the previous section is .tdata: .section .tdata,"awt",@progbits .align 4 .type as.2329.2082.2079, @tls_obj .size as.2329.2082.2079, 4 as.2329.2082.2079: .long 3 .local _OBJC_CLASS_NAME_3.2072.2064 .comm _OBJC_CLASS_NAME_3.2072.2064,1,1 .tbss is marked SECTION_TLS | SECTION_BSS, while .tdata is SECTION_TLS only. The patch below handles this new case, fixes the issue and was bootstrapped without regressions on i386-pc-solaris2.11. I'll commit it to mainline as soon as a sparc-sun-solaris2.11 bootstrap has completed; right now, I have no intention of backporting it to the 4.4 and 4.5 branches unless there's a need. Rainer 2010-12-29 Rainer Orth PR target/38118 * config/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Also switch to .bss if coming from .tdata. * config/i386/sol2-10.h (ASM_OUTPUT_ALIGNED_COMMON): Likewise. diff -r b2a32256838e gcc/config/i386/sol2-10.h --- a/gcc/config/i386/sol2-10.h Tue Dec 28 20:30:06 2010 +0100 +++ b/gcc/config/i386/sol2-10.h Thu Dec 30 12:56:36 2010 +0100 @@ -58,8 +58,7 @@ { \ if (TARGET_SUN_TLS \ && in_section \ - && ((in_section->common.flags & (SECTION_TLS | SECTION_BSS)) \ - == (SECTION_TLS | SECTION_BSS))) \ + && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \ switch_to_section (bss_section); \ x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); \ } \ diff -r b2a32256838e gcc/config/sol2.h --- a/gcc/config/sol2.h Tue Dec 28 20:30:06 2010 +0100 +++ b/gcc/config/sol2.h Thu Dec 30 12:56:36 2010 +0100 @@ -279,7 +279,7 @@ } \ while (0) -/* Solaris 'as' has a bug: a .common directive in .tbss section +/* Solaris 'as' has a bug: a .common directive in .tbss or .tdata section behaves as .tls_common rather than normal non-TLS .common. */ #undef ASM_OUTPUT_ALIGNED_COMMON #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ @@ -287,8 +287,7 @@ { \ if (TARGET_SUN_TLS \ && in_section \ - && ((in_section->common.flags & (SECTION_TLS | SECTION_BSS)) \ - == (SECTION_TLS | SECTION_BSS))) \ + && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \ switch_to_section (bss_section); \ fprintf ((FILE), "%s", COMMON_ASM_OP); \ assemble_name ((FILE), (NAME)); \