From patchwork Mon Feb 11 12:17:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 1039766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495794-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Cp3Du85u"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43ylDF0T62z9sML for ; Mon, 11 Feb 2019 23:17:44 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=oNx57iVodrbVxcmKpzwhO8D0XiDbZYlYbw3UX1Qrl4M2jw0z1juan DBuNTrWJ8kqAIZ2uH65wPmUlR8X274SdgJ+mCKUVpW+Rr1hH00LZvnjg/+F75wos sWhhFTvsimr1iNvJAo/mdMLzHOB+LqzAK+bRDW9kY64GBXCyqHjf9s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=/PmCzmQfHkLY9Ea0kuMK04ie+cs=; b=Cp3Du85uU/zOgJqB2pb7 2bxC6TjzQyZMRlgsrAUp7PHA+hlxlAv/DnYNQbP/Nl/x906dtJ3rz5kudiee+2Hc xr3VY9O8tYd55uF/S7xq2U1gYG8v2hTHiWhuVx8WzC7O9J5XSDA+3y2EFH0TShfm cU4QndwyY8a/wfQQNNxwQME= Received: (qmail 19182 invoked by alias); 11 Feb 2019 12:17:37 -0000 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 Received: (qmail 19167 invoked by uid 89); 11 Feb 2019 12:17:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=revealed, detection X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Feb 2019 12:17:34 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id CEC9CE0 for ; Mon, 11 Feb 2019 13:17:30 +0100 (CET) Received: from smtp.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 AUdMYYdVFOqu for ; Mon, 11 Feb 2019 13:17:25 +0100 (CET) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id E8788DC for ; Mon, 11 Feb 2019 13:17:24 +0100 (CET) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id x1BCHNQJ005421; Mon, 11 Feb 2019 13:17:23 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: [build] Restore .init_array etc. detection on 64-bit Solaris Date: Mon, 11 Feb 2019 13:17:23 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes I noticed that HAVE_INITFINI_ARRAY_SUPPORT wasn't properly detected on Solaris 11.4 and up in 64-bit-default configurations when using gas (2.32) and Solaris ld. Closer inspection revealed the following: both Solaris as and gas <= 2.28 emit Section Header[7]: sh_name: .init_array.01005 sh_addr: 0 sh_flags: [ SHF_ALLOC ] sh_size: 0x4 sh_type: [ SHT_PROGBITS ] sh_offset: 0x4c sh_entsize: 0 sh_link: 0 sh_info: 0 sh_addralign: 0x4 while since gas 2.29 one gets both a warning initfini.s:1: Warning: ignoring incorrect section type for .init_array.01005 and Section Header[7]: sh_name: .init_array.01005 sh_addr: 0 sh_flags: [ SHF_WRITE SHF_ALLOC ] sh_size: 0x4 sh_type: [ SHT_INIT_ARRAY ] sh_offset: 0x4c sh_entsize: 0x8 (0 entries) sh_link: 0 sh_info: 0 sh_addralign: 0x4 Since sh_size < sh_entsize, when the resulting object is linked into an executable, the latter lacks the .init_array section completely. This seems a plausible thing to do and the workaround is easy: just double the size of test strings. The following patch does just that. Tested on {i386,amd64}-pc-solaris2.11 and sparc{,v9}-sun-solaris2.11 without regressions and proper HAVE_INITFINI_ARRAY_SUPPORT detection. Since this only affects Solaris ld, I've checked it in. Rainer # HG changeset patch # Parent 7f704296017d34ec13aa97b574555028c8a81ca6 Restore .init_array detection on 64-bit Solaris/x86 diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -374,16 +374,16 @@ EOF cat > conftest.s < /dev/null 2>&1 \ && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \ && $gcc_cv_objdump -s -j .init_array conftest \ - | grep HHHHDDDD > /dev/null 2>&1 \ + | grep HHHHHHHHDDDDDDDD > /dev/null 2>&1 \ && $gcc_cv_objdump -s -j .fini_array conftest \ - | grep GGGGCCCC > /dev/null 2>&1; then + | grep GGGGGGGGCCCCCCCC > /dev/null 2>&1; then gcc_cv_initfini_array=yes fi ;;