From patchwork Fri May 25 08:03:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 136808 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3291364lji; Fri, 25 May 2018 01:34:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo+a2UIfqHdSykgEkph6UqmTiTa2eH49fpY2bRvFrEJQSNOUHcnxG3EchwvbLNHzLeJ8t88 X-Received: by 2002:a62:4c53:: with SMTP id z80-v6mr1583914pfa.181.1527237248366; Fri, 25 May 2018 01:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527237248; cv=none; d=google.com; s=arc-20160816; b=1Jnp6N7RVbGkhTOQiQg56pXne1oMks2DWCKhpALIIk/bJ9e6P/iJ1f8xtSVVC2Jpx1 rkgc+ey41zGbHvLvNTZBo3LAhyq1fOoX8ZIAPv1bmubM7nXLFx1v9Kn5fjPEHkXFYQG+ bsPufutpHVaIRfEVNfOun34ulSHhV4XrQJjLhYMiNF8esIcJwSNGQnBNhLcG+fuXWN6+ 6W0PfoCYTGNNtKy2JPYgkbMHzQmGpjG7AdqjKP63vJDS9O/0ty56DoLVvYFb8ekc1i+z Ia7Q9kXDrev+gmFciFqwWmwGffOmot31hqmoQN5nFeO6WL8uiKQ+3Tio1ZDKPvhFcpSc COyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=jDSe54S2QQ+MEA9LflrDgM3HNwbPzy+IkhcYDErdEvk=; b=aob4ABkG8cJSUEzwOCoo+nZNYpfY89cVy7/aN6bCYF9E00zjIgI1sUK1vrYjaIgo/V 1ak1Uy8gQBjtwb/YgUO3moDKsZ+d1cn/1taThfrQvsHu+BSnAKRKUMxNuyicia+5hv3Z QFbn9uSHk32tWndQDhbShVCndQutSYpSFGKUJ8aLLvRRXthmBiIrGMgZoqYbH4jwIRDL Swh2OSRaonzNGE40dQM7x+XxwqUXhjEQn0r4r+pKMwejeYfP8FNOMpRTx0MONh4oFZ8C jROjt9+2IvRrMtFSetJn/An27AKwK13UPzC38V7wna+okc1tg+zFw5KeZSXtGpPwjFPl 3NoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=enMfCdza; spf=pass (google.com: domain of gcc-patches-return-478475-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-478475-patch=linaro.org@gcc.gnu.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w21-v6si22705802plp.199.2018.05.25.01.34.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 01:34:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-478475-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=enMfCdza; spf=pass (google.com: domain of gcc-patches-return-478475-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-478475-patch=linaro.org@gcc.gnu.org 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:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=tY9 wGA9Wpf+Dw4G+oAVdZGNMKzN4yYVWthEoYxzEk5ztQMlZPEOFQ+mE3yi4CQ3Ukyi qiVBIs5NK/Mzv8GHe8mhpzj6Beh7ClM4CS+9qVAYckdmNmjxJ+DmzXAIJlMOc7kd UuPb0A5Q75kv0xZ83HHj49trAng75veEDsVoC1Yo= 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:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=default; bh=xQB8MsXO0 qkQVDnAQOw4//21D80=; b=enMfCdza5j9nPaxCrXHWmD0x5C0L3H2rTsf2hzTCF O4hU0yyHkHkatLfsRUWh00/VANETRwS0BXCgOnNoAGrO6/wJYT6bdkaOOo6tIUrU OZ8p9qEPBpwANjNohacsA57LXBO9i8iv3J75UVonVoq8RwFj5R58ENn40OzwnUsC 5I= Received: (qmail 74384 invoked by alias); 25 May 2018 08:09:42 -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 43076 invoked by uid 89); 25 May 2018 08:05:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx07-00178001.pphosted.com Received: from mx08-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (91.207.212.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 May 2018 08:05:53 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w4P7wZMc011595; Fri, 25 May 2018 10:05:51 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2j59qwu3vr-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 25 May 2018 10:05:51 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EAEEE3F; Fri, 25 May 2018 08:05:50 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node1.st.com [10.75.127.13]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D18081B22; Fri, 25 May 2018 08:05:50 +0000 (GMT) Received: from gnb.st.com (10.75.127.51) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 25 May 2018 10:05:50 +0200 From: Christophe Lyon To: , Subject: [ARM/FDPIC 05/21] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation Date: Fri, 25 May 2018 10:03:18 +0200 Message-ID: <20180525080354.13295-6-christophe.lyon@st.com> In-Reply-To: <20180525080354.13295-1-christophe.lyon@st.com> References: <20180525080354.13295-1-christophe.lyon@st.com> MIME-Version: 1.0 X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG5NODE1.st.com (10.75.127.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-25_03:, , signatures=0 X-IsSubscribed: yes In FDPIC, we need to make sure __do_global_dtors_aux and frame_dummy are referenced by their address, not by pointers to the function descriptors. 2018-XX-XX Christophe Lyon Mickaël Guêné * libgcc/crtstuff.c: Add support for FDPIC. Change-Id: Iff3aec3815e8ebd87276c0107752f00908a22100 -- 2.6.3 diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c index 5e89445..7238d9a 100644 --- a/libgcc/crtstuff.c +++ b/libgcc/crtstuff.c @@ -432,9 +432,17 @@ __do_global_dtors_aux (void) #ifdef FINI_SECTION_ASM_OP CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux) #elif defined (FINI_ARRAY_SECTION_ASM_OP) +#if defined(__FDPIC__) +__asm__( + " .section .fini_array\n" + " .word __do_global_dtors_aux\n" +); +asm (TEXT_SECTION_ASM_OP); +#else /* defined(__FDPIC__) */ static func_ptr __do_global_dtors_aux_fini_array_entry[] __attribute__ ((__used__, section(".fini_array"), aligned(sizeof(func_ptr)))) = { __do_global_dtors_aux }; +#endif /* defined(__FDPIC__) */ #else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */ static void __attribute__((used)) __do_global_dtors_aux_1 (void) @@ -476,9 +484,17 @@ frame_dummy (void) #ifdef __LIBGCC_INIT_SECTION_ASM_OP__ CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy) #else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ +#if defined(__FDPIC__) +__asm__( + " .section .init_array\n" + " .word frame_dummy\n" +); +asm (TEXT_SECTION_ASM_OP); +#else /* defined(__FDPIC__) */ static func_ptr __frame_dummy_init_array_entry[] __attribute__ ((__used__, section(".init_array"), aligned(sizeof(func_ptr)))) = { frame_dummy }; +#endif /* defined(__FDPIC__) */ #endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ #endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */