From patchwork Thu Mar 22 14:38:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 132300 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp932102ljb; Thu, 22 Mar 2018 07:41:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+oYPvbFWZb8F/yNc6qFWlrhWdnTAJrc5Rg6cD/OW76E/XqWKWBl+YxZNbIwwn6Pg98u1x X-Received: by 10.101.85.9 with SMTP id f9mr18211047pgr.189.1521729697821; Thu, 22 Mar 2018 07:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521729697; cv=none; d=google.com; s=arc-20160816; b=G+7jGE3NATmjKacpkGdBiX8ZeAkzpiN5okznKA/wOUtC9nj/3ug8Clj7Aka/t8UkA8 rQ9LLIS5ikWulXAjnoHo5b29ECpKXfMAN8H2lpsCceepAswo4alls6mdsek+OamYCw/I Ob74AdbJ+3zt9YF2pO3+KcJuDIlEpzt1SQyf5xFNHluL+sQEFKsxLuPi3FptXayUI/o4 0kUCc95kJgB1UYL8LG86Oszt4YzgzI+nKGvfkW8ocozBfDi8gHrYu6HfLxNcCmqS9H7U YQwZIyhB5bOnLsGhTgWRG89hpEvhVbuq4ukxYgt9HOKe6MihGzJ4X4g0FSr9ig7AQceo S8yg== 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-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=vTxJvWMKxcBzIVvZh6qnR4PnmgmkNMu6w4++um4MZIk=; b=Lh9ATkx7L/YJQkfAKGoFo8SpFRbQdkgfc/9w76wy+srvWyClyZivCi0Ajf1clseJbH UP9tTnTpVNWDFDM4P5sfevYyjQZLaKLtxWlgEBfIXyejV+2PTeAlwRLiOcW3/AIb/dW0 msP7pUHDyNc33vRuHyIC8vZI4CFzpobpxKH5vcEUcAcQPQTgD5qL6ZdsClmOH43cVEtM PSkFkQaQ4Jt+tVF7aAnXMY75v/A3WPrMIBJ6ECHwho8Fgi4hc0EtfkmOJDoBf2M64B6Q p9FE6BGyk6ylm95zzsIXUDvcmn3oVZl78lgCiwzF6TwEBQhZ1oboH1doRYYbI6OZ6jxx n+nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=m8RfKDJ2; spf=pass (google.com: domain of binutils-return-101086-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-101086-patch=linaro.org@sourceware.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 70-v6si6441119ple.639.2018.03.22.07.41.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 07:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-101086-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=m8RfKDJ2; spf=pass (google.com: domain of binutils-return-101086-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-101086-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe: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=wSC0zvmt9xfwjkAwTR3KrvpqlY3SPP3ywonHNIrhSWJ yBIvt0yBeeegAs02Q7IROZIAEBQpZXiCi+eBg6sJtLr8f7hK96W7b5TjruIGcbaX EoU80jbtDuC7YWYX4Mi8TwDvtHqwC1gmSgslJxs33Be7kaNJCUIq0gz9gZtsnidM = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe: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=euupn47Bcx8FQaWz2P8+BycmF38=; b=m8RfKDJ21iz7DljNe 2w7i0YLY7EdIu0ixp9XRr2aaUbKOpAmKcDIJT9JQtubOfl71a58K2caexLZZ2IqS GxFHsVOAcpX7E6mIwwqlxwnptQT9cy3TgZ5p+kS9/2IJSlxhhZbfmo9KttT8N7Rz Yk9+agdv8d0v9AhXCjMIkwKO2w= Received: (qmail 80251 invoked by alias); 22 Mar 2018 14:41:24 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 80168 invoked by uid 89); 22 Mar 2018 14:41:23 -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 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; Thu, 22 Mar 2018 14:41:22 +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 w2MEcfo4001270 for ; Thu, 22 Mar 2018 15:41:20 +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 2gv9sx1fmd-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 22 Mar 2018 15:41:20 +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 A697B31 for ; Thu, 22 Mar 2018 14:41:16 +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 94A7C2B11 for ; Thu, 22 Mar 2018 14:41:16 +0000 (GMT) Received: from gnx2104.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; Thu, 22 Mar 2018 15:41:16 +0100 From: Christophe Lyon To: Subject: [ARM-FDPIC 07/12] [ARM] FDPIC: Add stack segment Date: Thu, 22 Mar 2018 15:38:25 +0100 Message-ID: <20180322143850.1766-8-christophe.lyon@st.com> In-Reply-To: <20180322143850.1766-1-christophe.lyon@st.com> References: <20180322143850.1766-1-christophe.lyon@st.com> MIME-Version: 1.0 X-ClientProxiedBy: SFHDAG4NODE1.st.com (10.75.127.10) To SFHDAG5NODE1.st.com (10.75.127.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-22_07:, , signatures=0 X-IsSubscribed: yes The size of the stack segment defaults to 32KB, and can be overridden by defining the __stacksize symbol. 2018-XX-XX Christophe Lyon Mickaël Guêné bfd/ * elf32-arm.c (DEFAULT_STACK_SIZE): New. (elf32_arm_always_size_sections): Create stack segment. --- bfd/elf32-arm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.6.3 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 0e03c77..6ba4ee4 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -2251,6 +2251,9 @@ typedef unsigned short int insn16; section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" +/* FDPIC default stack size. */ +#define DEFAULT_STACK_SIZE 0x8000 + static const unsigned long tls_trampoline [] = { 0xe08e0000, /* add r0, lr, r0 */ @@ -16488,6 +16491,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p) /* Not an error, just cut short the traversal. */ return FALSE; } + return TRUE; } @@ -16958,6 +16962,9 @@ elf32_arm_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) { asection *tls_sec; + struct elf32_arm_link_hash_table *htab; + + htab = elf32_arm_hash_table (info); if (bfd_link_relocatable (info)) return TRUE; @@ -16990,6 +16997,12 @@ elf32_arm_always_size_sections (bfd *output_bfd, (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE); } } + + if (htab->fdpic_p && !bfd_link_relocatable (info) + && !bfd_elf_stack_segment_size (output_bfd, info, + "__stacksize", DEFAULT_STACK_SIZE)) + return FALSE; + return TRUE; }