From patchwork Fri Nov 16 15:47:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 151353 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp587029ljp; Fri, 16 Nov 2018 07:50:11 -0800 (PST) X-Google-Smtp-Source: AJdET5f0XqFyiOg7FJ6acEAMjtD3ocldY8CFSctYrJK72u7fLNSRJ1s7S8LFDsEcwdYrogmKOCLk X-Received: by 2002:a17:902:6946:: with SMTP id k6mr8193917plt.101.1542383411645; Fri, 16 Nov 2018 07:50:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542383411; cv=none; d=google.com; s=arc-20160816; b=BiY1r/RKYaOSFg63rfOrcXpMvy3fbiukCibYMoPNPo2ftp8ETH+ufzWKrV4fec+9wo ExEfXChPnSZ7dNDDeXfwk/3GgmGIOzOpQUoJvAIqPR/OaCD7sH+cQzgmKIXoUXv3YmGF 2u3bygicUOjp2UkCjOr1tzjW31KaAkwk5CzDxw1cjGEIZzBMuOlINIroO7QW0dl11a49 9+LnBRIbpMBorPT/XuDufD5oefrikiucIoAxgGQAiegcmnwWkWsViL3RBVFcgB+cip+T fCMQ/JXA9SJRXrFH2K5H9OWAtJaM0QPQ+f4z8jFrxqvfv7DZ3jTwVip0Nl+eJ6Twe4se fZgg== 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=3Vy0QheEv/32LOyHrIJ0wqWALWc0o6pSk3L7dSne9sM=; b=zxxtE0N/ohsJSoasQ+7K+JWCYjsd3d9T4p30bblLc2I6UIOIFkIzbNLeEeIdHCW7OB 4h/5kxp7vuUG0ovLv20fUutSXvtVPbL57QnRKuO41aT4rHHxJvHIRNUDQXmTLDCGxzvJ JduyF6uytaWB0hU44MPHHwlPQo0MGAj1/DtGt+R9tW67SKEKhp3Y5kc5jZ/ZqCxqsgoC J8s+mMOBhDWHFrXy7ch0rMZlO5k63epkK6XTIKZoV3YprU1xNoHMBvdeSbrLRBrBFbvm CBKVF8nOKijjiVE6BUsaJ47QkNQrpO6qkQo+tMA/demKMmO3Y1C1qRYGqb8tYa2PJKs7 acjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=bnf3Zx25; spf=pass (google.com: domain of gcc-patches-return-490267-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-490267-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 k190-v6si29980270pgk.261.2018.11.16.07.50.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 07:50:11 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-490267-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=bnf3Zx25; spf=pass (google.com: domain of gcc-patches-return-490267-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-490267-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=AGn5xUb1aE1ihCa+l2fMb0ZJHamykglGf3Shm6Lab5XSENYWL/OOw NB1F63ZEBnjcje6lEohk++z8BtuDxCNuNN6+bEce/jmTkHhWF4IpTfUHv5Um1Stl Mrl2moHINshWMH1gf2tb/kqJxqzPSt1uPDPJ91/WEAC03NQ7Sgn8RQ= 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=VIPH3qGuoUMrP9F189Ftz96r7Fw=; b=bnf3Zx254Sv/BCPXoBZHN8XQFJNn qVQjo0utmYMnroYc3H9zRFhJIVTKsiJ1FP789I1QpEueBlaQkOYMIEDlT49biaso S/4cKYK7rt/MFWGfD+G4qbLBBeaenT4maUj7mC9XBef724EgSjDRmlhGgA2dtx33 isXNbJti04KSbPU= Received: (qmail 91437 invoked by alias); 16 Nov 2018 15:50:00 -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 90587 invoked by uid 89); 16 Nov 2018 15:49:59 -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 mx07-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (62.209.51.94) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Nov 2018 15:49:58 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id wAGFim6K002148; Fri, 16 Nov 2018 16:49:56 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2nsx068w2q-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 16 Nov 2018 16:49:56 +0100 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 61C8338; Fri, 16 Nov 2018 15:49:54 +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 4B2C25011; Fri, 16 Nov 2018 15:49:54 +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; Fri, 16 Nov 2018 16:49:53 +0100 From: Christophe Lyon To: CC: Subject: [ARM/FDPIC v4 05/20] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation Date: Fri, 16 Nov 2018 16:47:33 +0100 Message-ID: <20181116154808.25154-6-christophe.lyon@st.com> In-Reply-To: <20181116154808.25154-1-christophe.lyon@st.com> References: <20181116154808.25154-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. -- 2.6.3 diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c index d81c527..8d4ce81 100644 --- a/libgcc/crtstuff.c +++ b/libgcc/crtstuff.c @@ -429,9 +429,18 @@ __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" + " .align 2\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 +482,18 @@ 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" + " .align 2\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 */