From patchwork Mon Apr 1 14:42:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 161538 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp550438jan; Mon, 1 Apr 2019 07:43:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaopvkCBS9NsdwulbUSwRJmUiYuzfLZf7xmptnvpXEG0HVCE9FndymHawRZCPtXTzFZQ/S X-Received: by 2002:a63:6193:: with SMTP id v141mr60832803pgb.392.1554129795637; Mon, 01 Apr 2019 07:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554129795; cv=none; d=google.com; s=arc-20160816; b=QDVVITNiVnthwBVC0EkB6iurZNxKs/+DLSG+FKPqW475LS3myUx5T8YjWRRvZ+w5DB dZgaHtn0GJec1xT4yzJeLSdxPeq6ESNL9vHqrqJGrYx1WtPNKQlutXtv40qCHr+HEfjF yS+/wkGaXzDfHMgLH7eN0bJm+9RsKFwypPckVWS8ZbRm1iNGdHbHbP7UaloZQGqvaAES kKQcdl83j9k2c4nPsi6uvIQpBaET2KnQFUzobxL+GSJliN7agMhfEc0xyqVnYWa1TKtn O1PeXy6NwNQOY1++CXHWFE9pnApS9ma7a3HiwWVD6nFC90KrTMJ7LYJVB4BhCICimTVY rhlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=Gs9Ey2T7R5QLVUr20drrL6HZspfBoip3JTdH59q8pZ8=; b=idAE3tqWGaB/v3vojh2zL/Ls1EgVksCrB5RAoUc/8gXaCNOdZl/wm2r0kPtTCK53oi xoTlzWYC/6hxj6X88DYzHT1XtbX/QiffPXuO/nARg916fa2yfg328fN2FCAB+aboI1Yh E1UkqvGSz+jtxroj8BDyc33SjeA/o18khgxI0dmUVHaWdOnu2Mj1Abhu2CTROtNvoqrr 6ndXIag1eDDAk31GdEFAmwrqbP+CSJYbeslP+NX542HS4X9tMAtzDo0Pq/JHFWSdkVNn yzDh9T+OB3g6cKwFrYhfNKa5Mw27JnY2728thkwJEchL7oP6pyD8NZSJxrGttQ1nncAh iFGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=J2rKbtQ+; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=qCvOCCwF; spf=pass (google.com: domain of newlib-return-16841-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="newlib-return-16841-patch=linaro.org@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d186si8882141pfa.218.2019.04.01.07.43.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 07:43:15 -0700 (PDT) Received-SPF: pass (google.com: domain of newlib-return-16841-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=J2rKbtQ+; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=qCvOCCwF; spf=pass (google.com: domain of newlib-return-16841-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="newlib-return-16841-patch=linaro.org@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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:mime-version:from:date:message-id:subject:to :content-type; q=dns; s=default; b=NmtWf8tGy3yGB36/SF/G+hBqVVeqk k6v9qq0R+2VTsi7UByk1KfSrzVT9KgFSDPSYgDzzyukHJzMnLUVyfWvK82EEA7Iu Lz+7vZDRgqTGqfVWlnHKMMOtwpvHYIPKTFalaaXebdGT/7EVLdcldiKuelwZGv8y 4UqgFahwdWEMwg= 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:mime-version:from:date:message-id:subject:to :content-type; s=default; bh=q7ThYr2j9m7ezWLHw7+Sw2giKe4=; b=J2r KbtQ+DeqgFUaw07F9hoL7hPl9Zd8EN1YRyubHsN1ld5Nq9opga76lerKFBVjY/aT yAWMng5YS9FC+yj7tj4KlyIb6UMHLn5h8T76da+3thSxP464yYS5Po8jCtd8QBBv Suvo4D/1WdTWtJe3GAZd0nN2S//sudMfkTFdqm5o= Received: (qmail 3537 invoked by alias); 1 Apr 2019 14:43:07 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Delivered-To: mailing list newlib@sourceware.org Received: (qmail 3511 invoked by uid 89); 1 Apr 2019 14:43:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=proof, HX-Envelope-From:sk:christo, sk:christo, libgloss X-HELO: mail-ua1-f48.google.com Received: from mail-ua1-f48.google.com (HELO mail-ua1-f48.google.com) (209.85.222.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 Apr 2019 14:43:04 +0000 Received: by mail-ua1-f48.google.com with SMTP id d5so3160274uan.6 for ; Mon, 01 Apr 2019 07:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=5KcQJh1Zb62E7TCf3LO1YVjdkf13CA4fbmMOnEoofio=; b=qCvOCCwFeOCYeVKXeJvme//F7IIfUJwiNPF04QtlCtQS6TfHE9AzsxhJdoBCYkqa8S lqST3ZdTvRrfU2bimOK/b7FkUQSYHxCG3QDQIedo/90mcJkSNMVEZAmXSVTIioxvyIGU RbpAb8GigIe5kS52/Jroa7HPhqQFSl8knotXPE66ACODqDZ7fJmWT+0Ly4jEi1P3yVa8 NzBgDIJT6lc1eZ/6+V5GIn3ZBvvS5zFYK9+ebyQ6WCq83OsM8vgrCJDsTagcQhvQjTbp 31a/Pdvm94V/O0ROpCqp4VqXJkL0m36nvebPnqgmweaqe/c78vm4xJ0dWErtAf3BQ+Vj q8Sg== MIME-Version: 1.0 From: Christophe Lyon Date: Mon, 1 Apr 2019 16:42:51 +0200 Message-ID: Subject: Make more macro checks ARMv8-M baseline proof To: newlib@sourceware.org X-IsSubscribed: yes Hi, After Thomas' patch (https://sourceware.org/ml/newlib/2016/msg00017.html), it seems that some changes committed to libgloss are missing in newlib. I noticed the problem when building a toolchain where GCC is configured --with-cpu=cortex-m{0,23}. This small patch brings the necessary changes from libgloss to newlib. With this, the GCC toolchain build completes. OK? Thanks, Christophe 2019-04-01 Christophe Lyon Make more macro checks ARMv8-M baseline proof. Commit 69f4c4029183fb26d2fcae00790881620c1978a3 improved most macro checks to be ARMv8-M baseline proof, but missed a few occurrences which otherwise fail to build when using a CPU setting such as cortex-m0 or cortex-m23. This patch brings the same changes as the ones that were committed to libgloss at that time. newlib: * libc/sys/arm/crt0.S: Use THUMB1_ONLY rather than __ARM_ARCH_6M__. * libc/sys/arm/trap.S: Use PREFER_THUMB rather than __thumb2__. diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S index 64d4259..8c9f7be 100644 --- a/newlib/libc/sys/arm/crt0.S +++ b/newlib/libc/sys/arm/crt0.S @@ -85,7 +85,7 @@ /* Stack limit is at end of data. */ /* Allow slop for stack overflow handling and small frames. */ -#ifdef __ARM_ARCH_6M__ +#ifdef THUMB1_ONLY ldr r0, .LC2 adds r0, #128 adds r0, #128 @@ -137,7 +137,7 @@ beq .LC27 /* Allow slop for stack overflow handling and small frames. */ -#ifdef __ARM_ARCH_6M__ +#ifdef THUMB1_ONLY adds r2, #128 adds r2, #128 mov sl, r2 @@ -164,7 +164,7 @@ #ifdef __thumb2__ it eq #endif -#ifdef __ARM_ARCH_6M__ +#ifdef THUMB1_ONLY bne .LC28 ldr r3, .LC0 .LC28: @@ -219,7 +219,7 @@ this default 64k is enough for the program being executed. However, it ensures that this simple crt0 world will not immediately cause an overflow event: */ -#ifdef __ARM_ARCH_6M__ +#ifdef THUMB1_ONLY movs r2, #64 lsls r2, r2, #10 subs r2, r3, r2 diff --git a/newlib/libc/sys/arm/trap.S b/newlib/libc/sys/arm/trap.S index 21b6937..d854b57 100644 --- a/newlib/libc/sys/arm/trap.S +++ b/newlib/libc/sys/arm/trap.S @@ -1,5 +1,6 @@ +#include "arm.h" /* Run-time exception support */ -#if !defined(__thumb2__) +#ifndef PREFER_THUMB #include "swi.h" /* .text is used instead of .section .text so it works with arm-aout too. */