From patchwork Mon Sep 9 15:44:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 173394 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp4535564ilq; Mon, 9 Sep 2019 08:47:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfIyt9IuoQn6Of84mbY0od1Sv46bJbI08U0oqsvISwsIJnMKA8+6hwNZTHuMmrZrXUnEAx X-Received: by 2002:aa7:ce02:: with SMTP id d2mr24903848edv.270.1568044054544; Mon, 09 Sep 2019 08:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568044054; cv=none; d=google.com; s=arc-20160816; b=OkgGl7SB8nbq5fBmAaXLvN/VwxqcrRMDujLOzSq8IroL45c+xijKiXsYHL+NUx2iZ4 eDiInLnbRpl3crzsTd3MMPJD0T9VNyysqhl+MkREgMoV9bSv/nQicGAGTMtzvodBph+/ ehTcB3/7JQBDJwvEld8r3f8W/ZCD5NNCCgJTdtjhgstSqc8ZL+LxhEzzUXDB0WDmQYVm HRNaLRpdzPFkue+COfK6cJrUIYhNI3yyQSdV16HimFjz+Y0s12jqz1v4ZCFHL+2ZxSqE 004EVUoehNeIwCxzbGnTn4ZSZ11XAcY0qvVkf7ADMYW9+0na6dZw8v1MhDWW/ATz0xM+ 6BIg== 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=qzqjIa9m2glbaH0qse0GvzBJVtGVjy+4eBBdCp9fJhA=; b=DNsrWdejOl3rT7mDg/XnydwXzRR2qBI7cPBv5/jz3BgHMygfC53OkSJ0il2gACQ7MW eMPSqH6pYFPJwqon8kLmUPlfRttJ8hvrbbvMr2D+at+XFby1OrhrQgWWdnHDEYN/9c6T ZZ6kDLTH3Pbz30sZiBg9DufITRgliGiP2VXg5ANJDyeFgAP4BS2w96XGdlz26dQoYkl+ ubg4+FpjIlS0WIWjKi3Iamr3bOKnCmCtI9uIn+lX7NsD9c5nC8B4SAUeo6nw9tknCMAC QzfZLfVA3rps6wr3tSVTDm64hywcRLKJr6rbzLab6k8K/J9eV+wczoupNmw7PAmRmHg7 rlZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=FMqqK9Nv; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=GYXZCKYN; spf=pass (google.com: domain of gcc-patches-return-508647-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-508647-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 t22si7859937ejx.202.2019.09.09.08.47.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Sep 2019 08:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-508647-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=FMqqK9Nv; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=GYXZCKYN; spf=pass (google.com: domain of gcc-patches-return-508647-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-508647-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=wrY M5V2k3aWVgosERomkaU90UBJsnThx+ppzatyqNhvoP893aPrlhufdMnRDe8qdLUv EBj79i8vu6+rTlsMTyxHJ9Lqi4D4aGjlbwaIrXuJNKxUfTLV2E8PRyyoKGk9GB0e rJKUOLipe/2WaPFqBofLe4Z2mFZ+wEQFcUfjW9Ms= 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=pRRi4DY7B mPTz3K6EHOkgfFhz3k=; b=FMqqK9Nvs2L1/6xNCZ2XMFWpAgjzhUaqLjk+m31FB 6uJkaEacJJfY+dX90/FYO6gmVo2+Hhfd8OeNLV3q34x4W4eyYqvPH1cQurLWPZc/ MRK3m3Embs0CtAQQMV2huA6xqOPUQrlUug84Ob+h0v9Gp8pAU++I4lxm4Ap/LcWH wQ= Received: (qmail 116528 invoked by alias); 9 Sep 2019 15:47:21 -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 116514 invoked by uid 89); 9 Sep 2019 15:47:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 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=__asm__, 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; Mon, 09 Sep 2019 15:47:20 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x89FkPQO001291 for ; Mon, 9 Sep 2019 17:47:17 +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=qzqjIa9m2glbaH0qse0GvzBJVtGVjy+4eBBdCp9fJhA=; b=GYXZCKYNrUp2KDYeEO/RzGna4t09dVBT3Xvms4GXZOSKfVkkzVoN2THTC3x7BMkXUaOV Zxnl0S1emxlXx+WpDGy4F3ge6sVEOD7ckwB3qxGeyu5GNNuAdFXM3b6Og0SM1tRMFDq4 EO2LxLhsUhA8GX40d/mwKaRJ6w+RSmKK3ua8aCKcCet3cepnpvRTXbzD2gE6jCwOv3HB DSdbS7i8ULftWop+8R/rPd/hQ0/nitJ07chUjY5xX4ATdj1K+juaIC/nEX0CZrty37eZ U+IyeA0cifnGytTZVNbpOxiP3LpwyGs0t9l11uus4XxZKnJU4Y5udGJ3ct0cMfh5PmCu AQ== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com with ESMTP id 2uv212ek6a-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 09 Sep 2019 17:47:17 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A7D734B for ; Mon, 9 Sep 2019 15:47:14 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node1.st.com [10.75.127.13]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 15E542B9BCC for ; Mon, 9 Sep 2019 17:47:14 +0200 (CEST) Received: from gnb.st.com (10.75.127.46) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 9 Sep 2019 17:47:13 +0200 From: Christophe Lyon To: Subject: [ARM/FDPIC v6 05/24] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation Date: Mon, 9 Sep 2019 17:44:47 +0200 Message-ID: <20190909154526.11630-6-christophe.lyon@st.com> In-Reply-To: <20190909154526.11630-1-christophe.lyon@st.com> References: <20190909154526.11630-1-christophe.lyon@st.com> MIME-Version: 1.0 X-IsSubscribed: yes From: Christophe Lyon 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/ * libgcc/crtstuff.c: Add support for FDPIC. Change-Id: I0bc4b1232fbf3c69068fb23a1b9cafc895d141b1 -- 2.6.3 diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c index c8a8e2c..c93e1cb 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__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n"); +extern char __do_global_dtors_aux_alias; +static void *__do_global_dtors_aux_fini_array_entry[] +__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *)))) + = { &__do_global_dtors_aux_alias }; +#else /* defined(__FDPIC__) */ static func_ptr __do_global_dtors_aux_fini_array_entry[] __attribute__ ((__used__, section(".fini_array"), aligned(__alignof__(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__("\t.equ\t__frame_dummy_alias, frame_dummy\n"); +extern char __frame_dummy_alias; +static void *__frame_dummy_init_array_entry[] +__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *)))) + = { &__frame_dummy_alias }; +#else /* defined(__FDPIC__) */ static func_ptr __frame_dummy_init_array_entry[] __attribute__ ((__used__, section(".init_array"), aligned(__alignof__(func_ptr)))) = { frame_dummy }; +#endif /* defined(__FDPIC__) */ #endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ #endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */