From patchwork Wed May 15 12:39:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 164280 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp603393oca; Wed, 15 May 2019 05:42:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyED/pbEwHsEfbKfg+JGiR+kBbIToVrWNIWG7S6OoCXfq1qhwuOnPsyzNaMOjBETh/RGoZl X-Received: by 2002:a63:2d87:: with SMTP id t129mr43998453pgt.451.1557924130991; Wed, 15 May 2019 05:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557924130; cv=none; d=google.com; s=arc-20160816; b=IDnoWXlOijt3S+QAEDK5qI9mqTKSjHEXDPLtbUC7vIMsrgS+0R1V5tn6sbzV297BL1 cd8bvMB8z8ZjiOF65y+74UiBnn/iNQOz/j3Tsk9Hr0lg6yVtItuNKuMOCR62TO4WRAbR PiWhEGY5mrjptkNoVyGWJGOMPxxDD1m1k+tJgbTiYbJE6/bw+5p7nC5BEUCheDOLRsbi CUgbjP46JXoLbwkYKeH2Y8ePmPRtTuYKaBx6mI0gnmB69SoAusF2YDiy2F+Cch7vUm31 VXzGkcoJoFINnVRy0Fz7wEEzJiGRSTtOOP+0K5Zhyf/CEMKG1VBD9+3rWJQpGUj7GwV9 yXeQ== 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:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature; bh=ODXjMO45F6yf0qYZ0QWTkk4SOuzykAzSlWGudMGYlfM=; b=06f2P/yyg9tSDyFZKO72Uuh3hzdGDxU77UL23oRGbdpkvM+F4++L4lRqU/y47Cfdfm 0D03+WKzlp+vfgRm6YHpokfPPC8KA2QtlXBAulsro7++OswTi+lSXAfQc4+YVj/z+yTT M6V9rOqN5YabZ0T25I8dVrSDh6g5XM4C78QKpdR9Ss9sBOmX295WeWBKf6IWZKYuiGmb PJlSbzS59a2O04l7fLooJRebJZuVjzD1WcxfvQZ551xTEbm2CktHUS5KDo8RCgt9IPGL 7e/bvti7OHD+HOGuK2IZV/OMOkb/tH1pkCgoNhvldA1LjtSFKeIDfvpQZbCHfY8l+A51 ++eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=s8WokRKo; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="bZKwGu/u"; spf=pass (google.com: domain of gcc-patches-return-500769-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-500769-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 p10si1656842plr.137.2019.05.15.05.42.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 05:42:10 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-500769-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=s8WokRKo; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="bZKwGu/u"; spf=pass (google.com: domain of gcc-patches-return-500769-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-500769-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=yaE HTwdmTXyuPaTAIBhoqE2A+K6JdAsIkIO9eoWC2k3by3+ci1Z96I5Wbdx+VUEVb02 TnG42/dsglJWfV22XoyQzDLcYT8h/pvTRYSARtOlGP/7MJfF8zu2CrAgud9uofJj HgS/VbT9JHUEhhu5b55XbmmPHRjNfP0h4sVrWhaM= 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=9QwoZYdYQ Kq2Tn5rp0H1+A9cfk4=; b=s8WokRKoX5rfK4kaFxDMDMl4QCYvShigvgR4/x0/Z 960p6HErJfDQ8lJo7bNrh8r1mWqXEt85VDW7jBZoYLXFxb8Kai5++5XFxiCLOTdk A64eEo87t8yPpqJkcgNa1AlmhPbP5SoOXjZGvZ/kaW6smf28JAmm/+DTqU9w4EX/ AY= Received: (qmail 26124 invoked by alias); 15 May 2019 12:41:59 -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 25734 invoked by uid 89); 15 May 2019 12:41:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.2 required=5.0 tests=AWL, 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.1 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; Wed, 15 May 2019 12:41:58 +0000 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4FCaWDa006112 for ; Wed, 15 May 2019 14:41:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=STMicroelectronics; bh=ODXjMO45F6yf0qYZ0QWTkk4SOuzykAzSlWGudMGYlfM=; b=bZKwGu/uuKpFOePMwLDBgGI9NFz3sE9IkoB5+2Q3WLQ/57yDF9dlC4J8+H2Mz51G2/vB qjBbPrVAqCX8M1VSAabO4r/vZvuNZycWWrC4eC58GYRq7vh4MAGjeihz8grvEfleniEp 4cMHTnm+NJCFuI43HZKFZXPAVm0DP+VdzybfYL0Rl9myjwasW1/6j8H27NcfSdIY67HW NRKCmh+QRbrMrz9mTD1Dfg9vWRmHj7/0QXfPoAMyUtoQJLzcwIhPMsg7xLaaYxBkrlVt 9E3PzdfNjLG87rdvi1KkfQ8ftFY+EOK/kgyL6am/3W+txRa72Be4hI5O9uNViQHlbSII eQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2sg0an6b2b-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 15 May 2019 14:41:56 +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 A523034 for ; Wed, 15 May 2019 12:41:55 +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 955402756 for ; Wed, 15 May 2019 12:41:55 +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; Wed, 15 May 2019 14:41:54 +0200 From: Christophe Lyon To: Subject: [ARM/FDPIC v5 05/21] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation Date: Wed, 15 May 2019 14:39:30 +0200 Message-ID: <20190515124006.25840-6-christophe.lyon@st.com> In-Reply-To: <20190515124006.25840-1-christophe.lyon@st.com> References: <20190515124006.25840-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. 2019-XX-XX Christophe Lyon Mickaël Guêné * libgcc/crtstuff.c: Add support for FDPIC. Change-Id: I0bc4b1232fbf3c69068fb23a1b9cafc895d141b1 -- 2.6.3 diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c index 4927a9f..159b461 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 */