From patchwork Thu Oct 11 13:34:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 148629 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2138341lji; Thu, 11 Oct 2018 06:37:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV61ftLD7RdgCr2iWf2ud1LvdcDVzdK3Nmlvx9UhhxcLTJ43/wPmps2cds7NL2L2ApIE6j2xr X-Received: by 2002:a17:902:162:: with SMTP id 89-v6mr1609620plb.91.1539265054969; Thu, 11 Oct 2018 06:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539265054; cv=none; d=google.com; s=arc-20160816; b=NeoDraVzUpwt3SuZMnZ3haPLByOeMIG0Wg8k/H02p2kVT8Vxhl9TPPSoKKEGpsRiOk Ejrz2MlRoALxkXGBzmhxdCvRj4mfGYANuvvtjA5stPpRgTh/CC/NEE880i9tVw3Rcpm0 m/HLU8ikW0OUX9c1fUP6BLrtNsEiDvvoeyJO8lqVHI95Mor8Ujsprqa5oK/HYAWgR0/m uajU3el4jWXdHgZEXtvaeSu4lUPMLEth5Wq/BvrUrLJql54is59YXnPFh9HN40nrs8/W uPQmbkqpacfQ2jL3h190fjPuXSezoKFp1YFxgCGdbYe42eEs1VDtVLEzbjbsdmSLcYeD v8sw== 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:cc:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature; bh=ty+6gXOrG67Q9wvUqZZEHdSBz7LyBzvgIp9REALCqqs=; b=GxR20u+E/uYln9VpLvhwNMrefhYoYnZZXEP1lvqoSS/m4HuS7CchxjeezRqp+hceef u2RBjUBnX+uCTtEL6ksDSsLAhnubSVUyZ/y8SLUSMrtw8MeZPiQW22j9FhiUVCNbsySY i3RY5eXzj87t+UBgKeM8b7n0gQkt0acVQeaw/RikCndtYxrM40TEzdEOkRaMt7HDeaUM RoY6TWrJyKd9E6Dp1YDWnWFqAj9ObPe3MUE/nvE9bd/9F66tK4u+crvzblWw/fLbUQMk JZ/QBrh2axvtruU6aVNdJ70oBFLJU/LZbmwplJ9FwLFKIGL1L1jHGkHlGlWn4KWC5l8m OV9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qAgDk38K; spf=pass (google.com: domain of gcc-patches-return-487335-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-487335-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 l9-v6si28423894pfi.179.2018.10.11.06.37.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Oct 2018 06:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-487335-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=qAgDk38K; spf=pass (google.com: domain of gcc-patches-return-487335-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-487335-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:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=Vkp0WOjOaV0H/L4566baPYITGgf0DLWfBThUkXVWIqiuarUGvtzbc na1aZyoRYEi4IS3/kBiEcKgFgjNrHhXWMHvMkvWxhF2DzX6auNJFien+OoGtuUTw Gmky0243+bx86l2tn55a0KJ3l7Gk1lhPj9LCf7ue/Ju078KrQRDrpk= 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:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=kmXNlGIFLMpv/K845ucFAz0Z318=; b=qAgDk38KPP/u9eEKZQW+k0Am5ML1 TClTdFpDHK+GdshQZVj0iTrIKYe3Db0nwlYYwrL00Yp+0bX8nd1TDl6cI94wjOn4 stDLwajXbsvVcKUIZxoNsUTT3rr39/AFxTFkD1Qz468vaLhCsRa79p9DkxTWv/q8 rw+TKWDkmBSuTaQ= Received: (qmail 2767 invoked by alias); 11 Oct 2018 13:37:18 -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 2570 invoked by uid 89); 11 Oct 2018 13:37:17 -0000 Authentication-Results: sourceware.org; auth=none 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; Thu, 11 Oct 2018 13:37:15 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w9BDSuk1004139; Thu, 11 Oct 2018 15:37:13 +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 2mxkxfdc4y-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 11 Oct 2018 15:37:13 +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 092A838; Thu, 11 Oct 2018 13:37:13 +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 EA8B9554C; Thu, 11 Oct 2018 13:37:12 +0000 (GMT) Received: from gnb.st.com (10.75.127.45) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 11 Oct 2018 15:37:12 +0200 From: Christophe Lyon To: CC: Subject: [ARM/FDPIC v3 05/21] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation Date: Thu, 11 Oct 2018 15:34:42 +0200 Message-ID: <20181011133518.17258-6-christophe.lyon@st.com> In-Reply-To: <20181011133518.17258-1-christophe.lyon@st.com> References: <20181011133518.17258-1-christophe.lyon@st.com> MIME-Version: 1.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 d81c527..ad40719 100644 --- a/libgcc/crtstuff.c +++ b/libgcc/crtstuff.c @@ -429,9 +429,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) @@ -473,9 +481,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 */