From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id B15AB385B51F; Thu, 12 Jan 2023 01:46:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B15AB385B51F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673488016; bh=N04AmLhf58dGlBAo9ZfraEi2sEngqi6WXsaJ2lkcpts=; h=From:To:Subject:Date:From; b=EQFicM2bGcEkZJxB6boox5YZ6NsxMTEd4q60+skWfTKnZDiYRVDz8wa177Qy5+JHa eABXlN06QijySbbA6qnkSNN6DqjlX60DeaN9qAySJ60ir7vvO1KwHfIDuQ6+WEJgxv f68rrVc4XRufwmYxyAfqDdDxnQvvT1DfQCOTa4O4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] libgloss: arm: break newlib dependency X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: 31e5ce10db46bf8c15d78b2546553db45eb33141 X-Git-Newrev: 26f9cfd7a8034919448ab4604a9c9d39c04b8d19 Message-Id: <20230112014656.B15AB385B51F@sourceware.org> Date: Thu, 12 Jan 2023 01:46:56 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D26f9cfd7a80= 34919448ab4604a9c9d39c04b8d19 commit 26f9cfd7a8034919448ab4604a9c9d39c04b8d19 Author: Mike Frysinger Date: Wed Dec 14 03:20:32 2022 -0500 libgloss: arm: break newlib dependency =20 The libgloss port has been reaching back into newlib internals for a single header whose contents have been frozen for almost a decade. To break this backwards libgloss->newlib dependency, move the acle header to the srcroot include/ so everyone can use the same copy. Diff: --- .../arm/acle-compat.h =3D> include/arm-acle-compat.h | 0 libgloss/Makefile.am | 3 + libgloss/Makefile.in | 2 + libgloss/arm/Makefile.in | 2 - libgloss/arm/arm.h | 2 +- libgloss/config/default.mh | 2 +- newlib/Makefile.am | 3 +- newlib/Makefile.in | 4 +- newlib/libc/machine/arm/aeabi_memcpy-armv7a.S | 2 +- newlib/libc/machine/arm/aeabi_memmove-thumb.S | 2 +- newlib/libc/machine/arm/aeabi_memset-thumb.S | 2 +- newlib/libc/machine/arm/arm_asm.h | 2 +- newlib/libc/machine/arm/machine/acle-compat.h | 182 -----------------= ---- newlib/libc/machine/arm/memchr-stub.c | 2 +- newlib/libc/machine/arm/memchr.S | 2 +- newlib/libc/machine/arm/memcpy-stub.c | 2 +- newlib/libc/machine/arm/memcpy.S | 2 +- newlib/libc/machine/arm/setjmp.S | 2 +- newlib/libc/machine/arm/strcmp.S | 2 +- newlib/libc/machine/arm/strlen-armv7.S | 2 +- newlib/libc/machine/arm/strlen-thumb2-Os.S | 2 +- newlib/libc/machine/arm/strlen.S | 2 +- newlib/libc/sys/arm/arm.h | 2 +- 23 files changed, 25 insertions(+), 203 deletions(-) diff --git a/newlib/libc/machine/arm/acle-compat.h b/include/arm-acle-compa= t.h similarity index 100% rename from newlib/libc/machine/arm/acle-compat.h rename to include/arm-acle-compat.h diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am index 5b5f0fd54..18b32fad2 100644 --- a/libgloss/Makefile.am +++ b/libgloss/Makefile.am @@ -11,6 +11,7 @@ PHONY =3D =20 SUBDIRS =3D @subdirs@ . =20 +srcroot =3D $(top_srcdir)/.. tooldir =3D $(exec_prefix)/$(target_alias) =20 multilibtooldir =3D $(tooldir)/lib$(MULTISUBDIR) @@ -23,6 +24,8 @@ includetool_DATA =3D includesystooldir =3D $(tooldir)/include/sys includesystool_DATA =3D =20 +AM_CPPFLAGS =3D -idirafter $(srcroot)/include + # A fake library so automake will generate rules for plain objects that we= want # to install (e.g. our crt0.o objects). noinst_LIBRARIES =3D libobjs.a diff --git a/libgloss/Makefile.in b/libgloss/Makefile.in index cd60857d1..77bb9b027 100644 --- a/libgloss/Makefile.in +++ b/libgloss/Makefile.in @@ -657,6 +657,7 @@ info_TEXINFOS =3D $(am__append_1) CLEANFILES =3D $(am__append_4) PHONY =3D=20 SUBDIRS =3D @subdirs@ . +srcroot =3D $(top_srcdir)/.. tooldir =3D $(exec_prefix)/$(target_alias) multilibtooldir =3D $(tooldir)/lib$(MULTISUBDIR) multilibtool_DATA =3D $(am__append_3) $(am__append_7) $(am__append_9) \ @@ -669,6 +670,7 @@ includetooldir =3D $(tooldir)/include includetool_DATA =3D $(am__append_10) includesystooldir =3D $(tooldir)/include/sys includesystool_DATA =3D $(am__append_11) +AM_CPPFLAGS =3D -idirafter $(srcroot)/include =20 # A fake library so automake will generate rules for plain objects that we= want # to install (e.g. our crt0.o objects). diff --git a/libgloss/arm/Makefile.in b/libgloss/arm/Makefile.in index 06fae10c1..d0d5ea89d 100644 --- a/libgloss/arm/Makefile.in +++ b/libgloss/arm/Makefile.in @@ -97,8 +97,6 @@ IQ80310_INSTALL =3D install-iq80310 # Host specific makefile fragment comes in here. @host_makefile_frag@ =20 -INCLUDES +=3D `if [ -d ${objroot}/newlib ]; then echo -I$(srcroot)/newlib/= libc/machine/arm; fi` - # # build a test program for each target board. Just trying to get # it to link is a good test, so we ignore all the errors for now. diff --git a/libgloss/arm/arm.h b/libgloss/arm/arm.h index 10e5b0509..f3cd49308 100644 --- a/libgloss/arm/arm.h +++ b/libgloss/arm/arm.h @@ -29,7 +29,7 @@ #ifndef _LIBGLOSS_ARM_H #define _LIBGLOSS_ARM_H =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 /* Checking for targets supporting only Thumb instructions (eg. ARMv6-M) or supporting Thumb-2 instructions, whether ARM instructions are available= or diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh index 4e7f106f9..81f0920f9 100644 --- a/libgloss/config/default.mh +++ b/libgloss/config/default.mh @@ -1,7 +1,7 @@ NEWLIB_CFLAGS =3D `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/new= lib/targ-include -I${srcroot}/newlib/libc/include; fi` NEWLIB_LDFLAGS =3D `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/ne= wlib/ -L${objroot}/newlib/; fi` =20 -INCLUDES =3D -I. -I$(srcdir)/.. -I$(objdir)/.. +INCLUDES =3D -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/inclu= de # Note that when building the library, ${MULTILIB} is not the way multilib # options are passed; they're passed in $(CFLAGS). CFLAGS_FOR_TARGET =3D -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} diff --git a/newlib/Makefile.am b/newlib/Makefile.am index 0108d8576..3bebf27eb 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -63,13 +63,14 @@ AM_MAKEFLAGS =3D \ =20 FLAGS_TO_PASS=3D$(AM_MAKEFLAGS) =20 +srcroot =3D $(top_srcdir)/.. tooldir =3D $(exec_prefix)/$(host_alias) toollibdir =3D $(tooldir)/lib$(MULTISUBDIR) =20 # These are useful for standalone object files like crt0.o. AM_CFLAGS =3D $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D= )_$(=3D 7 && defined (__ARM_ARCH_ISA_ARM) # define _ISA_ARM_7 diff --git a/newlib/libc/machine/arm/machine/acle-compat.h b/newlib/libc/ma= chine/arm/machine/acle-compat.h deleted file mode 100644 index 888ae2ea8..000000000 --- a/newlib/libc/machine/arm/machine/acle-compat.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2014 ARM Ltd - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the company may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLI= ED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTA= L, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __ARM_ARCH - -/* ACLE standardises a set of pre-defines that describe the ARM architectu= re. - These were mostly implemented in GCC around GCC-4.8; older versions - have no, or only partial support. To provide a level of backwards - compatibility we try to work out what the definitions should be, given - the older pre-defines that GCC did produce. This isn't complete, but - it should be enough for use by routines that depend on this header. */ - -/* No need to handle ARMv8, GCC had ACLE support before that. */ - -# ifdef __ARM_ARCH_7__ -/* The common subset of ARMv7 in all profiles. */ -# define __ARM_ARCH 7 -# define __ARM_ARCH_ISA_THUMB 2 -# define __ARM_FEATURE_CLZ -# define __ARM_FEATURE_LDREX 7 -# define __ARM_FEATURE_UNALIGNED -# endif - -# if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) -# define __ARM_ARCH 7 -# define __ARM_ARCH_ISA_THUMB 2 -# define __ARM_ARCH_ISA_ARM -# define __ARM_FEATURE_CLZ -# define __ARM_FEATURE_SIMD32 -# define __ARM_FEATURE_DSP -# define __ARM_FEATURE_QBIT -# define __ARM_FEATURE_SAT -# define __ARM_FEATURE_LDREX 15 -# define __ARM_FEATURE_UNALIGNED -# ifdef __ARM_ARCH_7A__ -# define __ARM_ARCH_PROFILE 'A' -# else -# define __ARM_ARCH_PROFILE 'R' -# endif -# endif - -# ifdef __ARM_ARCH_7EM__ -# define __ARM_ARCH 7 -# define __ARM_ARCH_ISA_THUMB 2 -# define __ARM_FEATURE_CLZ -# define __ARM_FEATURE_SIMD32 -# define __ARM_FEATURE_DSP -# define __ARM_FEATURE_QBIT -# define __ARM_FEATURE_SAT -# define __ARM_FEATURE_LDREX 7 -# define __ARM_FEATURE_UNALIGNED -# define __ARM_ARCH_PROFILE 'M' -# endif - -# ifdef __ARM_ARCH_7M__ -# define __ARM_ARCH 7 -# define __ARM_ARCH_ISA_THUMB 2 -# define __ARM_FEATURE_CLZ -# define __ARM_FEATURE_QBIT -# define __ARM_FEATURE_SAT -# define __ARM_FEATURE_LDREX 7 -# define __ARM_FEATURE_UNALIGNED -# define __ARM_ARCH_PROFILE 'M' -# endif - -# ifdef __ARM_ARCH_6T2__ -# define __ARM_ARCH 6 -# define __ARM_ARCH_ISA_THUMB 2 -# define __ARM_ARCH_ISA_ARM -# define __ARM_FEATURE_CLZ -# define __ARM_FEATURE_SIMD32 -# define __ARM_FEATURE_DSP -# define __ARM_FEATURE_QBIT -# define __ARM_FEATURE_SAT -# define __ARM_FEATURE_LDREX 4 -# define __ARM_FEATURE_UNALIGNED -# endif - -# ifdef __ARM_ARCH_6M__ -# define __ARM_ARCH 6 -# define __ARM_ARCH_ISA_THUMB 1 -# define __ARM_ARCH_PROFILE 'M' -# endif - -# if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) \ - || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) \ - || defined (__ARM_ARCH_6ZK__) -# define __ARM_ARCH 6 -# define __ARM_ARCH_ISA_THUMB 1 -# define __ARM_ARCH_ISA_ARM -# define __ARM_FEATURE_CLZ -# define __ARM_FEATURE_SIMD32 -# define __ARM_FEATURE_DSP -# define __ARM_FEATURE_QBIT -# define __ARM_FEATURE_SAT -# define __ARM_FEATURE_UNALIGNED -# ifndef __thumb__ -# if defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__) -# define __ARM_FEATURE_LDREX 15 -# else -# define __ARM_FEATURE_LDREX 4 -# endif -# endif -# endif - -# if defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5E__) -# define __ARM_ARCH 5 -# define __ARM_ARCH_ISA_ARM -# ifdef __ARM_ARCH_5TE__ -# define __ARM_ARCH_ISA_THUMB 1 -# endif -# define __ARM_FEATURE_CLZ -# define __ARM_FEATURE_DSP -# endif - -# if defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5__) -# define __ARM_ARCH 5 -# define __ARM_ARCH_ISA_ARM -# ifdef __ARM_ARCH_5TE__ -# define __ARM_ARCH_ISA_THUMB 1 -# endif -# define __ARM_FEATURE_CLZ -# endif - -# ifdef __ARM_ARCH_4T__ -# define __ARM_ARCH 4 -# define __ARM_ARCH_ISA_ARM -# define __ARM_ARCH_ISA_THUMB 1 -# endif - -# ifdef __ARM_ARCH_4__ -# define __ARM_ARCH 4 -# define __ARM_ARCH_ISA_ARM -# endif - -# if defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__) -# define __ARM_ARCH 3 -# define __ARM_ARCH_ISA_ARM -# endif - -# ifdef __ARM_ARCH_2__ -# define __ARM_ARCH 2 -# define __ARM_ARCH_ISA_ARM -# endif - -# ifdef __ARMEB__ -# define __ARM_BIG_ENDIAN -# endif - -/* If we still don't know what the target architecture is, then we're - probably not using GCC. */ -# ifndef __ARM_ARCH -# error Unable to determine architecture version. -# endif - -#endif /* __ARM_ARCH */ - diff --git a/newlib/libc/machine/arm/memchr-stub.c b/newlib/libc/machine/ar= m/memchr-stub.c index 5c7881b9c..48451a136 100644 --- a/newlib/libc/machine/arm/memchr-stub.c +++ b/newlib/libc/machine/arm/memchr-stub.c @@ -27,7 +27,7 @@ /* The structure of the following #if #else #endif conditional chain must match the chain in memchr.S. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 #if defined (__ARM_NEON__) || defined (__ARM_NEON) /* Defined in memchr.S. */ diff --git a/newlib/libc/machine/arm/memchr.S b/newlib/libc/machine/arm/mem= chr.S index 3c11addad..d13ef8d65 100644 --- a/newlib/libc/machine/arm/memchr.S +++ b/newlib/libc/machine/arm/memchr.S @@ -75,7 +75,7 @@ =20 .syntax unified =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" #include "arm_asm.h" =20 @ NOTE: This ifdef MUST match the one in memchr-stub.c diff --git a/newlib/libc/machine/arm/memcpy-stub.c b/newlib/libc/machine/ar= m/memcpy-stub.c index 6cd0e3b1d..6f41a85e0 100644 --- a/newlib/libc/machine/arm/memcpy-stub.c +++ b/newlib/libc/machine/arm/memcpy-stub.c @@ -27,7 +27,7 @@ /* The structure of the following #if #else #endif conditional chain must match the chain in memcpy.S. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 #if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)) # include "../../string/memcpy.c" diff --git a/newlib/libc/machine/arm/memcpy.S b/newlib/libc/machine/arm/mem= cpy.S index 77bd2a606..8416232ec 100644 --- a/newlib/libc/machine/arm/memcpy.S +++ b/newlib/libc/machine/arm/memcpy.S @@ -29,7 +29,7 @@ /* The structure of the following #if #else #endif conditional chain must match the chain in memcpy-stub.c. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 #if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) /* Defined in memcpy-stub.c. */ diff --git a/newlib/libc/machine/arm/setjmp.S b/newlib/libc/machine/arm/set= jmp.S index 5213c063b..c615f2428 100644 --- a/newlib/libc/machine/arm/setjmp.S +++ b/newlib/libc/machine/arm/setjmp.S @@ -2,7 +2,7 @@ =20 Nick Clifton, Cygnus Solutions, 13 June 1997. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 /* ANSI concatenation macros. */ #define CONCAT(a, b) CONCAT2(a, b) diff --git a/newlib/libc/machine/arm/strcmp.S b/newlib/libc/machine/arm/str= cmp.S index 137f44969..ae308cfc7 100644 --- a/newlib/libc/machine/arm/strcmp.S +++ b/newlib/libc/machine/arm/strcmp.S @@ -28,7 +28,7 @@ =20 /* Wrapper for the various implementations of strcmp. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 #ifdef __ARM_BIG_ENDIAN #define S2LO lsl diff --git a/newlib/libc/machine/arm/strlen-armv7.S b/newlib/libc/machine/a= rm/strlen-armv7.S index 27094040c..6aa122c07 100644 --- a/newlib/libc/machine/arm/strlen-armv7.S +++ b/newlib/libc/machine/arm/strlen-armv7.S @@ -58,7 +58,7 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" #include "arm_asm.h" =20 .macro def_fn f p2align=3D0 diff --git a/newlib/libc/machine/arm/strlen-thumb2-Os.S b/newlib/libc/machi= ne/arm/strlen-thumb2-Os.S index a46db573c..4adbc61d2 100644 --- a/newlib/libc/machine/arm/strlen-thumb2-Os.S +++ b/newlib/libc/machine/arm/strlen-thumb2-Os.S @@ -24,7 +24,7 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" #include "arm_asm.h" =20 .macro def_fn f p2align=3D0 diff --git a/newlib/libc/machine/arm/strlen.S b/newlib/libc/machine/arm/str= len.S index 0435fb2de..d85a7eeb5 100644 --- a/newlib/libc/machine/arm/strlen.S +++ b/newlib/libc/machine/arm/strlen.S @@ -24,7 +24,7 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 #if defined __OPTIMIZE_SIZE__ || defined PREFER_SIZE_OVER_SPEED #if __ARM_ARCH_ISA_THUMB =3D=3D 2 diff --git a/newlib/libc/sys/arm/arm.h b/newlib/libc/sys/arm/arm.h index 10e5b0509..f3cd49308 100644 --- a/newlib/libc/sys/arm/arm.h +++ b/newlib/libc/sys/arm/arm.h @@ -29,7 +29,7 @@ #ifndef _LIBGLOSS_ARM_H #define _LIBGLOSS_ARM_H =20 -#include "acle-compat.h" +#include "arm-acle-compat.h" =20 /* Checking for targets supporting only Thumb instructions (eg. ARMv6-M) or supporting Thumb-2 instructions, whether ARM instructions are available= or