public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Various libgloss problems after recent changes
@ 2023-02-06  0:48 Jeff Law
  2023-02-09 22:54 ` Jeff Johnston
  2023-12-04  7:03 ` [PATCH 1/2] Revert "Fix libgloss/newlib build to conditionally use top include dir" Mike Frysinger
  0 siblings, 2 replies; 15+ messages in thread
From: Jeff Law @ 2023-02-06  0:48 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: newlib

The fr30-elf and xstormy16-elf ports have been failing to build for 
about a month with this error:

  > fr30-elf-as  -I. -I../../../../..//newlib-cygwin/libgloss/fr30/.. 
-I./.. -idirafter 
../../../../..//newlib-cygwin/libgloss/fr30/../../include  -o crt0.o 
../../../../..//newlib-cygwin/libgloss/fr30/crt0.s
> fr30-elf-as: unrecognized option '-idirafter'


For a full log:

http://law-sandy.freeddns.org:8080/job/fr30-elf/1984/console

Hopefully this is easy to fix so we can get those ports under regular 
testing again.

Jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-06  0:48 Various libgloss problems after recent changes Jeff Law
@ 2023-02-09 22:54 ` Jeff Johnston
  2023-02-10 11:21   ` Richard Earnshaw
  2023-02-10 16:52   ` Jeff Law
  2023-12-04  7:03 ` [PATCH 1/2] Revert "Fix libgloss/newlib build to conditionally use top include dir" Mike Frysinger
  1 sibling, 2 replies; 15+ messages in thread
From: Jeff Johnston @ 2023-02-09 22:54 UTC (permalink / raw)
  To: Jeff Law; +Cc: Mike Frysinger, newlib


[-- Attachment #1.1: Type: text/plain, Size: 694 bytes --]

Hi Jeff,

Want to try out the attached patch?

-- Jeff J.


On Sun, Feb 5, 2023 at 7:48 PM Jeff Law <jeffreyalaw@gmail.com> wrote:

> The fr30-elf and xstormy16-elf ports have been failing to build for
> about a month with this error:
>
>   > fr30-elf-as  -I. -I../../../../..//newlib-cygwin/libgloss/fr30/..
> -I./.. -idirafter
> ../../../../..//newlib-cygwin/libgloss/fr30/../../include  -o crt0.o
> ../../../../..//newlib-cygwin/libgloss/fr30/crt0.s
> > fr30-elf-as: unrecognized option '-idirafter'
>
>
> For a full log:
>
> http://law-sandy.freeddns.org:8080/job/fr30-elf/1984/console
>
> Hopefully this is easy to fix so we can get those ports under regular
> testing again.
>
> Jeff
>
>

[-- Attachment #2: 0001-Fix-libgloss-build-for-fr30-and-xstormy16.patch --]
[-- Type: text/x-patch, Size: 4083 bytes --]

From 29211fd70d0e8ad6660e2b552323747bc28e2941 Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Thu, 9 Feb 2023 16:59:31 -0500
Subject: [PATCH] Fix libgloss build for fr30 and xstormy16

- conditionally don't use -idirafter option
---
 libgloss/Makefile.am  |  4 ++++
 libgloss/Makefile.in  |  3 ++-
 libgloss/configure    | 17 +++++++++++++++++
 libgloss/configure.ac |  5 +++++
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 4309cd3..92d91bf 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -24,7 +24,11 @@ includetool_DATA =
 includesystooldir = $(tooldir)/include/sys
 includesystool_DATA =
 
+if HAVE_IDIRAFTER
 AM_CPPFLAGS = -idirafter $(srcroot)/include
+else
+AM_CPPFLAGS =
+endif
 
 # 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/Makefile.in b/libgloss/Makefile.in
index a117577..ebbf28c 100644
--- a/libgloss/Makefile.in
+++ b/libgloss/Makefile.in
@@ -807,7 +807,8 @@ includetooldir = $(tooldir)/include
 includetool_DATA = $(am__append_16)
 includesystooldir = $(tooldir)/include/sys
 includesystool_DATA = $(am__append_17)
-AM_CPPFLAGS = -idirafter $(srcroot)/include
+@HAVE_IDIRAFTER_FALSE@AM_CPPFLAGS = 
+@HAVE_IDIRAFTER_TRUE@AM_CPPFLAGS = -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).
diff --git a/libgloss/configure b/libgloss/configure
index 28754b6..a188a79 100755
--- a/libgloss/configure
+++ b/libgloss/configure
@@ -630,6 +630,8 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+HAVE_IDIRAFTER_FALSE
+HAVE_IDIRAFTER_TRUE
 CONFIG_WINCE_FALSE
 CONFIG_WINCE_TRUE
 CONFIG_RISCV_FALSE
@@ -2865,6 +2867,7 @@ case "${target}" in
 	ac_config_files="$ac_config_files fr30/Makefile"
 
 	subdirs="$subdirs fr30"
+	config_fr30=true
 	;;
   frv*-*-*)
 	ac_config_files="$ac_config_files frv/Makefile"
@@ -2925,6 +2928,7 @@ case "${target}" in
 	ac_config_files="$ac_config_files xstormy16/Makefile"
 
 	subdirs="$subdirs xstormy16"
+	config_xstormy16=true
 	;;
   m32c-*-*)
 	ac_config_files="$ac_config_files m32c/Makefile"
@@ -3081,6 +3085,15 @@ fi
 
 
 
+ if test x$config_fr30 = x && test x$config_xstormy16 = x; then
+  HAVE_IDIRAFTER_TRUE=
+  HAVE_IDIRAFTER_FALSE='#'
+else
+  HAVE_IDIRAFTER_TRUE='#'
+  HAVE_IDIRAFTER_FALSE=
+fi
+
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -5347,6 +5360,10 @@ if test -z "${CONFIG_WINCE_TRUE}" && test -z "${CONFIG_WINCE_FALSE}"; then
   as_fn_error $? "conditional \"CONFIG_WINCE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${HAVE_IDIRAFTER_TRUE}" && test -z "${HAVE_IDIRAFTER_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_IDIRAFTER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 5fb2684..4528b09 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -145,6 +145,7 @@ case "${target}" in
   fr30-*-*)
 	AC_CONFIG_FILES([fr30/Makefile])
 	subdirs="$subdirs fr30"
+	config_fr30=true
 	;;
   frv*-*-*)
 	AC_CONFIG_FILES([frv/Makefile])
@@ -194,6 +195,7 @@ case "${target}" in
   xstormy16-*-*)
 	AC_CONFIG_FILES([xstormy16/Makefile])
 	subdirs="$subdirs xstormy16"
+	config_xstormy16=true
 	;;
   m32c-*-*)
 	AC_CONFIG_FILES([m32c/Makefile])
@@ -252,6 +254,9 @@ m4_foreach_w([SUBDIR], [
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
 
+dnl fr30 and xstormy16 compilers don't support -idirafter
+AM_CONDITIONAL([HAVE_IDIRAFTER], [[test x$config_fr30] = x] && [[test x$config_xstormy16] = x])
+
 dnl For now, don't bother configuring testsuite
 dnl
 dnl if test "${config_testsuite}" = "true";
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-09 22:54 ` Jeff Johnston
@ 2023-02-10 11:21   ` Richard Earnshaw
  2023-02-10 16:54     ` Jeff Law
                       ` (2 more replies)
  2023-02-10 16:52   ` Jeff Law
  1 sibling, 3 replies; 15+ messages in thread
From: Richard Earnshaw @ 2023-02-10 11:21 UTC (permalink / raw)
  To: Jeff Johnston, Jeff Law; +Cc: Mike Frysinger, newlib



On 09/02/2023 22:54, Jeff Johnston wrote:
> Hi Jeff,
> 
> Want to try out the attached patch?
> 
> -- Jeff J.
> 
> 
> On Sun, Feb 5, 2023 at 7:48 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
> 
>> The fr30-elf and xstormy16-elf ports have been failing to build for
>> about a month with this error:
>>
>>    > fr30-elf-as  -I. -I../../../../..//newlib-cygwin/libgloss/fr30/..
>> -I./.. -idirafter
>> ../../../../..//newlib-cygwin/libgloss/fr30/../../include  -o crt0.o
>> ../../../../..//newlib-cygwin/libgloss/fr30/crt0.s
>>> fr30-elf-as: unrecognized option '-idirafter'
>>
>>
>> For a full log:
>>
>> http://law-sandy.freeddns.org:8080/job/fr30-elf/1984/console
>>
>> Hopefully this is easy to fix so we can get those ports under regular
>> testing again.
>>
>> Jeff
>>
>>

I'm slightly confused.  Why would some ports have -idirafter and some 
not, unless they're not using GCC (or a very old one).

So wouldn't a autoconf test for -idirafter be a better approach rather 
than hard-coding it.

Note that if it's due to the option not being supported in old versions 
of gcc, then that's a bigger problem because the reason the option was 
added in the first place (IIRC) was to support moving arm-acle-compat.h 
out of the newlib subdir so it could be used with libgloss.  And 
arm-acle-compat.h is there to support older versions of GCC.

And that brings up another question.  Just how old a version of GCC do 
we want to support these days?  ACLE support was added to GCC 10 years 
ago, in GCC-4.8. If we can drop support for compilers older than that, 
we can drop using the compatibility header and get rid of the need for 
-idirafter entirely.

R.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-09 22:54 ` Jeff Johnston
  2023-02-10 11:21   ` Richard Earnshaw
@ 2023-02-10 16:52   ` Jeff Law
  1 sibling, 0 replies; 15+ messages in thread
From: Jeff Law @ 2023-02-10 16:52 UTC (permalink / raw)
  To: Jeff Johnston; +Cc: Mike Frysinger, newlib



On 2/9/23 15:54, Jeff Johnston wrote:
> Hi Jeff,
> 
> Want to try out the attached patch?
Didn't make any difference.

Jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-10 11:21   ` Richard Earnshaw
@ 2023-02-10 16:54     ` Jeff Law
  2023-02-21 21:39       ` Jeff Johnston
  2023-02-10 17:16     ` Jeff Johnston
  2023-12-04  6:49     ` Mike Frysinger
  2 siblings, 1 reply; 15+ messages in thread
From: Jeff Law @ 2023-02-10 16:54 UTC (permalink / raw)
  To: Richard Earnshaw, Jeff Johnston; +Cc: Mike Frysinger, newlib



On 2/10/23 04:21, Richard Earnshaw wrote:
> 
> 
> On 09/02/2023 22:54, Jeff Johnston wrote:
>> Hi Jeff,
>>
>> Want to try out the attached patch?
>>
>> -- Jeff J.
>>
>>
>> On Sun, Feb 5, 2023 at 7:48 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>>
>>> The fr30-elf and xstormy16-elf ports have been failing to build for
>>> about a month with this error:
>>>
>>>    > fr30-elf-as  -I. -I../../../../..//newlib-cygwin/libgloss/fr30/..
>>> -I./.. -idirafter
>>> ../../../../..//newlib-cygwin/libgloss/fr30/../../include  -o crt0.o
>>> ../../../../..//newlib-cygwin/libgloss/fr30/crt0.s
>>>> fr30-elf-as: unrecognized option '-idirafter'
>>>
>>>
>>> For a full log:
>>>
>>> http://law-sandy.freeddns.org:8080/job/fr30-elf/1984/console
>>>
>>> Hopefully this is easy to fix so we can get those ports under regular
>>> testing again.
>>>
>>> Jeff
>>>
>>>
> 
> I'm slightly confused.  Why would some ports have -idirafter and some 
> not, unless they're not using GCC (or a very old one).
No clue.  FWIW, the tester is using the tip if the trunk for all the 
components (binutils, gcc, newlib/glibc).   I'm highly confident we're 
not picking up old tools as the builds occur in a docker container, so 
there's no pre-existing cross-tools installed.  The host compiler in 
those containers is roughly a year old.

jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-10 11:21   ` Richard Earnshaw
  2023-02-10 16:54     ` Jeff Law
@ 2023-02-10 17:16     ` Jeff Johnston
  2023-12-04  6:49     ` Mike Frysinger
  2 siblings, 0 replies; 15+ messages in thread
From: Jeff Johnston @ 2023-02-10 17:16 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: Jeff Law, Mike Frysinger, newlib

[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]

On Fri, Feb 10, 2023 at 6:21 AM Richard Earnshaw <
Richard.Earnshaw@foss.arm.com> wrote:

>
>
> On 09/02/2023 22:54, Jeff Johnston wrote:
> > Hi Jeff,
> >
> > Want to try out the attached patch?
> >
> > -- Jeff J.
> >
> >
> > On Sun, Feb 5, 2023 at 7:48 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
> >
> >> The fr30-elf and xstormy16-elf ports have been failing to build for
> >> about a month with this error:
> >>
> >>    > fr30-elf-as  -I. -I../../../../..//newlib-cygwin/libgloss/fr30/..
> >> -I./.. -idirafter
> >> ../../../../..//newlib-cygwin/libgloss/fr30/../../include  -o crt0.o
> >> ../../../../..//newlib-cygwin/libgloss/fr30/crt0.s
> >>> fr30-elf-as: unrecognized option '-idirafter'
> >>
> >>
> >> For a full log:
> >>
> >> http://law-sandy.freeddns.org:8080/job/fr30-elf/1984/console
> >>
> >> Hopefully this is easy to fix so we can get those ports under regular
> >> testing again.
> >>
> >> Jeff
> >>
> >>
>
> I'm slightly confused.  Why would some ports have -idirafter and some
> not, unless they're not using GCC (or a very old one).
>
> So wouldn't a autoconf test for -idirafter be a better approach rather
> than hard-coding it.
>

Yes, I should have picked a better flag name - I really just wanted to
exclude the 2 platforms that don't need the -idirafter statement in the
first place.
A better way would be to simply add a flag to indicate specifically that a
config wants to include files in top level include.


> Note that if it's due to the option not being supported in old versions
> of gcc, then that's a bigger problem because the reason the option was
> added in the first place (IIRC) was to support moving arm-acle-compat.h
> out of the newlib subdir so it could be used with libgloss.  And
> arm-acle-compat.h is there to support older versions of GCC.
>
> And that brings up another question.  Just how old a version of GCC do
> we want to support these days?  ACLE support was added to GCC 10 years
> ago, in GCC-4.8. If we can drop support for compilers older than that,
> we can drop using the compatibility header and get rid of the need for
> -idirafter entirely.
>
> R.
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-10 16:54     ` Jeff Law
@ 2023-02-21 21:39       ` Jeff Johnston
  2023-02-22  7:16         ` Jeff Law
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff Johnston @ 2023-02-21 21:39 UTC (permalink / raw)
  To: Jeff Law; +Cc: Richard Earnshaw, Mike Frysinger, newlib


[-- Attachment #1.1: Type: text/plain, Size: 1795 bytes --]

Hi Jeff,

Any progress on figuring out why -idirafter is being flagged for the
fr30-elf build?  I have reformulated a patch to conditionally specify
the top-level include directory only for arm configurations.  If the build
error is unavoidable for the time-being and you want to try the patch, it
is attached.

-- Jeff J.


On Fri, Feb 10, 2023 at 11:54 AM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
>
> On 2/10/23 04:21, Richard Earnshaw wrote:
> >
> >
> > On 09/02/2023 22:54, Jeff Johnston wrote:
> >> Hi Jeff,
> >>
> >> Want to try out the attached patch?
> >>
> >> -- Jeff J.
> >>
> >>
> >> On Sun, Feb 5, 2023 at 7:48 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
> >>
> >>> The fr30-elf and xstormy16-elf ports have been failing to build for
> >>> about a month with this error:
> >>>
> >>>    > fr30-elf-as  -I. -I../../../../..//newlib-cygwin/libgloss/fr30/..
> >>> -I./.. -idirafter
> >>> ../../../../..//newlib-cygwin/libgloss/fr30/../../include  -o crt0.o
> >>> ../../../../..//newlib-cygwin/libgloss/fr30/crt0.s
> >>>> fr30-elf-as: unrecognized option '-idirafter'
> >>>
> >>>
> >>> For a full log:
> >>>
> >>> http://law-sandy.freeddns.org:8080/job/fr30-elf/1984/console
> >>>
> >>> Hopefully this is easy to fix so we can get those ports under regular
> >>> testing again.
> >>>
> >>> Jeff
> >>>
> >>>
> >
> > I'm slightly confused.  Why would some ports have -idirafter and some
> > not, unless they're not using GCC (or a very old one).
> No clue.  FWIW, the tester is using the tip if the trunk for all the
> components (binutils, gcc, newlib/glibc).   I'm highly confident we're
> not picking up old tools as the builds occur in a docker container, so
> there's no pre-existing cross-tools installed.  The host compiler in
> those containers is roughly a year old.
>
> jeff
>
>

[-- Attachment #2: 0001-Fix-libgloss-newlib-build-to-conditionally-use-top-i.patch --]
[-- Type: text/x-patch, Size: 6469 bytes --]

From a0aeee695d77e0a4209ec233e2c8308678cbe0a4 Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Thu, 9 Feb 2023 16:59:31 -0500
Subject: [PATCH] Fix libgloss/newlib build to conditionally use top include
 dir

- conditionally use -idirafter option for arm
---
 libgloss/Makefile.am       |  4 ++++
 libgloss/Makefile.in       |  3 ++-
 libgloss/config/default.mh |  2 +-
 libgloss/configure         | 16 ++++++++++++++++
 libgloss/configure.ac      |  4 ++++
 newlib/Makefile.am         |  4 ++++
 newlib/Makefile.in         |  3 ++-
 7 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 4309cd3..d4b7d40 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -24,7 +24,11 @@ includetool_DATA =
 includesystooldir = $(tooldir)/include/sys
 includesystool_DATA =
 
+if NEED_TOP_INCLUDE_DIR
 AM_CPPFLAGS = -idirafter $(srcroot)/include
+else
+AM_CPPFLAGS =
+endif
 
 # 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/Makefile.in b/libgloss/Makefile.in
index a117577..187d0ed 100644
--- a/libgloss/Makefile.in
+++ b/libgloss/Makefile.in
@@ -807,7 +807,8 @@ includetooldir = $(tooldir)/include
 includetool_DATA = $(am__append_16)
 includesystooldir = $(tooldir)/include/sys
 includesystool_DATA = $(am__append_17)
-AM_CPPFLAGS = -idirafter $(srcroot)/include
+@NEED_TOP_INCLUDE_DIR_FALSE@AM_CPPFLAGS = 
+@NEED_TOP_INCLUDE_DIR_TRUE@AM_CPPFLAGS = -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).
diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh
index 81f0920..4e7f106 100644
--- a/libgloss/config/default.mh
+++ b/libgloss/config/default.mh
@@ -1,7 +1,7 @@
 NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
 NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
 
-INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/include
+INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/..
 # Note that when building the library, ${MULTILIB} is not the way multilib
 # options are passed; they're passed in $(CFLAGS).
 CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
diff --git a/libgloss/configure b/libgloss/configure
index 28754b6..c076104 100755
--- a/libgloss/configure
+++ b/libgloss/configure
@@ -630,6 +630,8 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+NEED_TOP_INCLUDE_DIR_FALSE
+NEED_TOP_INCLUDE_DIR_TRUE
 CONFIG_WINCE_FALSE
 CONFIG_WINCE_TRUE
 CONFIG_RISCV_FALSE
@@ -2949,6 +2951,7 @@ case "${target}" in
 	;;
   arm*-*-elf | arm*-*-coff | arm*-*-*)
 	config_arm=true
+	host_makefile_frag=${srcdir}/config/arm.mh
 	;;
   spu-*-elf)
 	ac_config_files="$ac_config_files spu/Makefile"
@@ -3081,6 +3084,15 @@ fi
 
 
 
+ if test x$config_arm = xtrue; then
+  NEED_TOP_INCLUDE_DIR_TRUE=
+  NEED_TOP_INCLUDE_DIR_FALSE='#'
+else
+  NEED_TOP_INCLUDE_DIR_TRUE='#'
+  NEED_TOP_INCLUDE_DIR_FALSE=
+fi
+
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -5347,6 +5359,10 @@ if test -z "${CONFIG_WINCE_TRUE}" && test -z "${CONFIG_WINCE_FALSE}"; then
   as_fn_error $? "conditional \"CONFIG_WINCE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${NEED_TOP_INCLUDE_DIR_TRUE}" && test -z "${NEED_TOP_INCLUDE_DIR_FALSE}"; then
+  as_fn_error $? "conditional \"NEED_TOP_INCLUDE_DIR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 5fb2684..a332193 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -214,6 +214,7 @@ case "${target}" in
 	;;
   arm*-*-elf | arm*-*-coff | arm*-*-*)
 	config_arm=true
+	host_makefile_frag=${srcdir}/config/arm.mh
 	;;
   spu-*-elf)
 	AC_CONFIG_FILES([spu/Makefile])
@@ -252,6 +253,9 @@ m4_foreach_w([SUBDIR], [
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
 
+dnl arm platforms have a special header file found in the main include directory
+AM_CONDITIONAL([NEED_TOP_INCLUDE_DIR], [[test x$config_arm] = xtrue])
+
 dnl For now, don't bother configuring testsuite
 dnl
 dnl if test "${config_testsuite}" = "true";
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 3bebf27..a188845 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -70,7 +70,11 @@ toollibdir = $(tooldir)/lib$(MULTISUBDIR)
 # These are useful for standalone object files like crt0.o.
 AM_CFLAGS = $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D)_$(<F)))
 AM_CCASFLAGS = $(AM_CCASFLAGS_$(subst /,_,$(@D))) $(AM_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
+if HAVE_LIBC_MACHINE_ARM
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
+else
+AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
+endif
 
 toollib_LIBRARIES = libm.a \
 	libc.a
diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index bc967bd..b168577 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -3848,7 +3848,8 @@ toollibdir = $(tooldir)/lib$(MULTISUBDIR)
 # These are useful for standalone object files like crt0.o.
 AM_CFLAGS = $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D)_$(<F)))
 AM_CCASFLAGS = $(AM_CCASFLAGS_$(subst /,_,$(@D))) $(AM_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
+@HAVE_LIBC_MACHINE_ARM_FALSE@AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
+@HAVE_LIBC_MACHINE_ARM_TRUE@AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
 toollib_LIBRARIES = libm.a libc.a $(am__append_72)
 @HAVE_MULTISUBDIR_TRUE@BUILD_MULTISUBDIR = $(builddir)$(MULTISUBDIR)
 toollib_DATA = $(CRT0) $(CRT1)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-21 21:39       ` Jeff Johnston
@ 2023-02-22  7:16         ` Jeff Law
  2023-02-22 16:20           ` Jeff Johnston
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff Law @ 2023-02-22  7:16 UTC (permalink / raw)
  To: Jeff Johnston; +Cc: Richard Earnshaw, Mike Frysinger, newlib



On 2/21/23 14:39, Jeff Johnston wrote:
> Hi Jeff,
> 
> Any progress on figuring out why -idirafter is being flagged for the 
> fr30-elf build?  I have reformulated a patch to conditionally specify
> the top-level include directory only for arm configurations.  If the 
> build error is unavoidable for the time-being and you want to try the 
> patch, it is attached.
Funny, I'd been poking at it a bit this morning, too much red on the 
dashboard.

I think the reason your patch didn't work is libgloss/config/default.mh 
also injects an idirafter.

jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-22  7:16         ` Jeff Law
@ 2023-02-22 16:20           ` Jeff Johnston
  2023-02-22 16:40             ` Jeff Law
  2023-02-22 17:54             ` Jeff Law
  0 siblings, 2 replies; 15+ messages in thread
From: Jeff Johnston @ 2023-02-22 16:20 UTC (permalink / raw)
  To: Jeff Law; +Cc: Richard Earnshaw, Mike Frysinger, newlib


[-- Attachment #1.1: Type: text/plain, Size: 886 bytes --]

Yes, I found that and fixed it in the patch I attached.  Are you saying
that patch didn't work as well?
I did forget to add the new arm.mh file I created but I have done so
locally and have reposted the patch here.

-- Jeff J.

On Wed, Feb 22, 2023 at 2:16 AM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
>
> On 2/21/23 14:39, Jeff Johnston wrote:
> > Hi Jeff,
> >
> > Any progress on figuring out why -idirafter is being flagged for the
> > fr30-elf build?  I have reformulated a patch to conditionally specify
> > the top-level include directory only for arm configurations.  If the
> > build error is unavoidable for the time-being and you want to try the
> > patch, it is attached.
> Funny, I'd been poking at it a bit this morning, too much red on the
> dashboard.
>
> I think the reason your patch didn't work is libgloss/config/default.mh
> also injects an idirafter.
>
> jeff
>
>

[-- Attachment #2: 0001-Fix-libgloss-newlib-build-to-conditionally-use-top-i.patch --]
[-- Type: text/x-patch, Size: 8074 bytes --]

From 3fa9dd00af9a0961d03cfead51008f71a1d16b46 Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Thu, 9 Feb 2023 16:59:31 -0500
Subject: [PATCH] Fix libgloss/newlib build to conditionally use top include
 dir

- conditionally use -idirafter option for arm
---
 libgloss/Makefile.am       |  4 ++++
 libgloss/Makefile.in       |  3 ++-
 libgloss/config/arm.mh     | 34 ++++++++++++++++++++++++++++++++++
 libgloss/config/default.mh |  2 +-
 libgloss/configure         | 16 ++++++++++++++++
 libgloss/configure.ac      |  4 ++++
 newlib/Makefile.am         |  4 ++++
 newlib/Makefile.in         |  3 ++-
 8 files changed, 67 insertions(+), 3 deletions(-)
 create mode 100644 libgloss/config/arm.mh

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 4309cd3..d4b7d40 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -24,7 +24,11 @@ includetool_DATA =
 includesystooldir = $(tooldir)/include/sys
 includesystool_DATA =
 
+if NEED_TOP_INCLUDE_DIR
 AM_CPPFLAGS = -idirafter $(srcroot)/include
+else
+AM_CPPFLAGS =
+endif
 
 # 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/Makefile.in b/libgloss/Makefile.in
index a117577..187d0ed 100644
--- a/libgloss/Makefile.in
+++ b/libgloss/Makefile.in
@@ -807,7 +807,8 @@ includetooldir = $(tooldir)/include
 includetool_DATA = $(am__append_16)
 includesystooldir = $(tooldir)/include/sys
 includesystool_DATA = $(am__append_17)
-AM_CPPFLAGS = -idirafter $(srcroot)/include
+@NEED_TOP_INCLUDE_DIR_FALSE@AM_CPPFLAGS = 
+@NEED_TOP_INCLUDE_DIR_TRUE@AM_CPPFLAGS = -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).
diff --git a/libgloss/config/arm.mh b/libgloss/config/arm.mh
new file mode 100644
index 0000000..81f0920
--- /dev/null
+++ b/libgloss/config/arm.mh
@@ -0,0 +1,34 @@
+NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
+NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
+
+INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/include
+# Note that when building the library, ${MULTILIB} is not the way multilib
+# options are passed; they're passed in $(CFLAGS).
+CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
+LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS}
+AR_FLAGS = rc
+
+.c.o:
+	$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+.C.o:
+	$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+.s.o:
+	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+
+#
+# GCC knows to run the preprocessor on .S files before it assembles them.
+#
+.S.o:
+	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
+
+#
+# this is a bogus target that'll produce an assembler from the
+# C source with the right compiler options. this is so we can
+# track down code generation or debug symbol bugs.
+#
+.c.s:
+	$(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $<
+
+# We don't build docs in subdirs, so stub out the rules.
+.PHONY: doc docs dvi html install-html info install-info clean-info pdf install-pdf
diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh
index 81f0920..4e7f106 100644
--- a/libgloss/config/default.mh
+++ b/libgloss/config/default.mh
@@ -1,7 +1,7 @@
 NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
 NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
 
-INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/include
+INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/..
 # Note that when building the library, ${MULTILIB} is not the way multilib
 # options are passed; they're passed in $(CFLAGS).
 CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
diff --git a/libgloss/configure b/libgloss/configure
index 28754b6..c076104 100755
--- a/libgloss/configure
+++ b/libgloss/configure
@@ -630,6 +630,8 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+NEED_TOP_INCLUDE_DIR_FALSE
+NEED_TOP_INCLUDE_DIR_TRUE
 CONFIG_WINCE_FALSE
 CONFIG_WINCE_TRUE
 CONFIG_RISCV_FALSE
@@ -2949,6 +2951,7 @@ case "${target}" in
 	;;
   arm*-*-elf | arm*-*-coff | arm*-*-*)
 	config_arm=true
+	host_makefile_frag=${srcdir}/config/arm.mh
 	;;
   spu-*-elf)
 	ac_config_files="$ac_config_files spu/Makefile"
@@ -3081,6 +3084,15 @@ fi
 
 
 
+ if test x$config_arm = xtrue; then
+  NEED_TOP_INCLUDE_DIR_TRUE=
+  NEED_TOP_INCLUDE_DIR_FALSE='#'
+else
+  NEED_TOP_INCLUDE_DIR_TRUE='#'
+  NEED_TOP_INCLUDE_DIR_FALSE=
+fi
+
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -5347,6 +5359,10 @@ if test -z "${CONFIG_WINCE_TRUE}" && test -z "${CONFIG_WINCE_FALSE}"; then
   as_fn_error $? "conditional \"CONFIG_WINCE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${NEED_TOP_INCLUDE_DIR_TRUE}" && test -z "${NEED_TOP_INCLUDE_DIR_FALSE}"; then
+  as_fn_error $? "conditional \"NEED_TOP_INCLUDE_DIR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 5fb2684..a332193 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -214,6 +214,7 @@ case "${target}" in
 	;;
   arm*-*-elf | arm*-*-coff | arm*-*-*)
 	config_arm=true
+	host_makefile_frag=${srcdir}/config/arm.mh
 	;;
   spu-*-elf)
 	AC_CONFIG_FILES([spu/Makefile])
@@ -252,6 +253,9 @@ m4_foreach_w([SUBDIR], [
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
 
+dnl arm platforms have a special header file found in the main include directory
+AM_CONDITIONAL([NEED_TOP_INCLUDE_DIR], [[test x$config_arm] = xtrue])
+
 dnl For now, don't bother configuring testsuite
 dnl
 dnl if test "${config_testsuite}" = "true";
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 3bebf27..a188845 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -70,7 +70,11 @@ toollibdir = $(tooldir)/lib$(MULTISUBDIR)
 # These are useful for standalone object files like crt0.o.
 AM_CFLAGS = $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D)_$(<F)))
 AM_CCASFLAGS = $(AM_CCASFLAGS_$(subst /,_,$(@D))) $(AM_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
+if HAVE_LIBC_MACHINE_ARM
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
+else
+AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
+endif
 
 toollib_LIBRARIES = libm.a \
 	libc.a
diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index bc967bd..b168577 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -3848,7 +3848,8 @@ toollibdir = $(tooldir)/lib$(MULTISUBDIR)
 # These are useful for standalone object files like crt0.o.
 AM_CFLAGS = $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D)_$(<F)))
 AM_CCASFLAGS = $(AM_CCASFLAGS_$(subst /,_,$(@D))) $(AM_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
+@HAVE_LIBC_MACHINE_ARM_FALSE@AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
+@HAVE_LIBC_MACHINE_ARM_TRUE@AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
 toollib_LIBRARIES = libm.a libc.a $(am__append_72)
 @HAVE_MULTISUBDIR_TRUE@BUILD_MULTISUBDIR = $(builddir)$(MULTISUBDIR)
 toollib_DATA = $(CRT0) $(CRT1)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-22 16:20           ` Jeff Johnston
@ 2023-02-22 16:40             ` Jeff Law
  2023-02-22 17:54             ` Jeff Law
  1 sibling, 0 replies; 15+ messages in thread
From: Jeff Law @ 2023-02-22 16:40 UTC (permalink / raw)
  To: Jeff Johnston; +Cc: Richard Earnshaw, Mike Frysinger, newlib



On 2/22/23 09:20, Jeff Johnston wrote:
> Yes, I found that and fixed it in the patch I attached.  Are you saying 
> that patch didn't work as well?
> I did forget to add the new arm.mh <http://arm.mh> file I created but I 
> have done so locally and have reposted the patch here.
I hadn't tried the latest patch, just the first plus a local hack to 
default.mh.  I'll drop your latest version into the tester  and spin up 
the fr30/xstormy builds.

Note that I'm on PTO shortly, so if you don't hear from me by tomorrow, 
I ran out of time and will have to deal with this when I'm back on March 6.

Thanks,
jeff



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-22 16:20           ` Jeff Johnston
  2023-02-22 16:40             ` Jeff Law
@ 2023-02-22 17:54             ` Jeff Law
  2023-02-22 18:06               ` Jeff Johnston
  1 sibling, 1 reply; 15+ messages in thread
From: Jeff Law @ 2023-02-22 17:54 UTC (permalink / raw)
  To: Jeff Johnston; +Cc: Richard Earnshaw, Mike Frysinger, newlib



On 2/22/23 09:20, Jeff Johnston wrote:
> Yes, I found that and fixed it in the patch I attached.  Are you saying 
> that patch didn't work as well?
> I did forget to add the new arm.mh <http://arm.mh> file I created but I 
> have done so locally and have reposted the patch here.
Your most recent patch works.

jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-22 17:54             ` Jeff Law
@ 2023-02-22 18:06               ` Jeff Johnston
  0 siblings, 0 replies; 15+ messages in thread
From: Jeff Johnston @ 2023-02-22 18:06 UTC (permalink / raw)
  To: Jeff Law; +Cc: Richard Earnshaw, Mike Frysinger, newlib

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

Great, thanks.

On Wed, Feb 22, 2023 at 12:55 PM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
>
> On 2/22/23 09:20, Jeff Johnston wrote:
> > Yes, I found that and fixed it in the patch I attached.  Are you saying
> > that patch didn't work as well?
> > I did forget to add the new arm.mh <http://arm.mh> file I created but I
> > have done so locally and have reposted the patch here.
> Your most recent patch works.
>
> jeff
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Various libgloss problems after recent changes
  2023-02-10 11:21   ` Richard Earnshaw
  2023-02-10 16:54     ` Jeff Law
  2023-02-10 17:16     ` Jeff Johnston
@ 2023-12-04  6:49     ` Mike Frysinger
  2 siblings, 0 replies; 15+ messages in thread
From: Mike Frysinger @ 2023-12-04  6:49 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: Jeff Johnston, Jeff Law, newlib

[-- Attachment #1: Type: text/plain, Size: 2144 bytes --]

On 10 Feb 2023 11:21, Richard Earnshaw wrote:
> On 09/02/2023 22:54, Jeff Johnston wrote:
> > On Sun, Feb 5, 2023 at 7:48 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
> >> The fr30-elf and xstormy16-elf ports have been failing to build for
> >> about a month with this error:
> >>
> >>    > fr30-elf-as  -I. -I../../../../..//newlib-cygwin/libgloss/fr30/..
> >> -I./.. -idirafter
> >> ../../../../..//newlib-cygwin/libgloss/fr30/../../include  -o crt0.o
> >> ../../../../..//newlib-cygwin/libgloss/fr30/crt0.s
> >>> fr30-elf-as: unrecognized option '-idirafter'
> 
> I'm slightly confused.  Why would some ports have -idirafter and some 
> not, unless they're not using GCC (or a very old one).
> 
> So wouldn't a autoconf test for -idirafter be a better approach rather 
> than hard-coding it.
> 
> Note that if it's due to the option not being supported in old versions 
> of gcc, then that's a bigger problem because the reason the option was 
> added in the first place (IIRC) was to support moving arm-acle-compat.h 
> out of the newlib subdir so it could be used with libgloss.  And 
> arm-acle-compat.h is there to support older versions of GCC.

the problem isn't gcc age, it's that $CPPFLAGS is being used with $AS,
and that's never correct.  filtering the flags for some ports hides the
issue by default ... if people set CPPFLAGS to include something else,
it will continue to fail.

really all $AS usage should switch to $CCAS which will compile .s files
with the compiler driver (i.e. `gcc`) which respects $CPPFLAGS.

a short term fix is prob to stop using $(INCLUDES) in the .s.o rule.  i
can't see how this was ever useful tbh.  we don't use `.include` in any
of the .s files, and `#include` doesn't work.
-mike

--- a/libgloss/config/default.mh
+++ b/libgloss/config/default.mh
@@ -14,7 +14,7 @@ AR_FLAGS = rc
 .C.o:
 	$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
 .s.o:
-	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+	$(AS) $(ASFLAGS_FOR_TARGET) $(ASFLAGS) -o $*.o $<
 
 #
 # GCC knows to run the preprocessor on .S files before it assembles them.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/2] Revert "Fix libgloss/newlib build to conditionally use top include dir"
  2023-02-06  0:48 Various libgloss problems after recent changes Jeff Law
  2023-02-09 22:54 ` Jeff Johnston
@ 2023-12-04  7:03 ` Mike Frysinger
  2023-12-04  7:03   ` [PATCH 2/2] libgloss: drop $(INCLUDES) when using $(AS) Mike Frysinger
  1 sibling, 1 reply; 15+ messages in thread
From: Mike Frysinger @ 2023-12-04  7:03 UTC (permalink / raw)
  To: newlib

This reverts commit 17ac400c11bab30ac2c0bef12cbf7788f0b6f954.

The build failures were due to incorrectly using $(INCLUDES) when
running $(AS).  Let's roll this back and drop $(INCLUDES) from the
$(AS) invocations.
---
 libgloss/Makefile.am       |  4 ----
 libgloss/Makefile.in       |  3 +--
 libgloss/config/arm.mh     | 34 ----------------------------------
 libgloss/config/default.mh |  2 +-
 libgloss/configure         | 16 ----------------
 libgloss/configure.ac      |  4 ----
 newlib/Makefile.am         |  4 ----
 newlib/Makefile.in         |  4 +---
 8 files changed, 3 insertions(+), 68 deletions(-)
 delete mode 100644 libgloss/config/arm.mh

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index f440ad23a1a6..0d4460b5801e 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -24,11 +24,7 @@ includetool_DATA =
 includesystooldir = $(tooldir)/include/sys
 includesystool_DATA =
 
-if NEED_TOP_INCLUDE_DIR
 AM_CPPFLAGS = -idirafter $(srcroot)/include
-else
-AM_CPPFLAGS =
-endif
 
 # 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/config/arm.mh b/libgloss/config/arm.mh
deleted file mode 100644
index 81f0920f97a8..000000000000
--- a/libgloss/config/arm.mh
+++ /dev/null
@@ -1,34 +0,0 @@
-NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
-NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
-
-INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/include
-# Note that when building the library, ${MULTILIB} is not the way multilib
-# options are passed; they're passed in $(CFLAGS).
-CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
-LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS}
-AR_FLAGS = rc
-
-.c.o:
-	$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
-
-.C.o:
-	$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
-.s.o:
-	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
-
-#
-# GCC knows to run the preprocessor on .S files before it assembles them.
-#
-.S.o:
-	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
-
-#
-# this is a bogus target that'll produce an assembler from the
-# C source with the right compiler options. this is so we can
-# track down code generation or debug symbol bugs.
-#
-.c.s:
-	$(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $<
-
-# We don't build docs in subdirs, so stub out the rules.
-.PHONY: doc docs dvi html install-html info install-info clean-info pdf install-pdf
diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh
index 4e7f106f9366..81f0920f97a8 100644
--- a/libgloss/config/default.mh
+++ b/libgloss/config/default.mh
@@ -1,7 +1,7 @@
 NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
 NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
 
-INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/..
+INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/include
 # Note that when building the library, ${MULTILIB} is not the way multilib
 # options are passed; they're passed in $(CFLAGS).
 CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 47854eab3170..19bdf9b3a6b9 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -217,7 +217,6 @@ case "${target}" in
 	;;
   arm*-*-elf | arm*-*-coff | arm*-*-*)
 	config_arm=true
-	host_makefile_frag=${srcdir}/config/arm.mh
 	;;
   spu-*-elf)
 	AC_CONFIG_FILES([spu/Makefile])
@@ -256,9 +255,6 @@ m4_foreach_w([SUBDIR], [
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
 
-dnl arm platforms have a special header file found in the main include directory
-AM_CONDITIONAL([NEED_TOP_INCLUDE_DIR], [[test x$config_arm] = xtrue])
-
 dnl For now, don't bother configuring testsuite
 dnl
 dnl if test "${config_testsuite}" = "true";
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 47f0be288093..4ab36b8d841c 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -70,11 +70,7 @@ toollibdir = $(tooldir)/lib$(MULTISUBDIR)
 # These are useful for standalone object files like crt0.o.
 AM_CFLAGS = $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D)_$(<F)))
 AM_CCASFLAGS = $(AM_CCASFLAGS_$(subst /,_,$(@D))) $(AM_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
-if HAVE_LIBC_MACHINE_ARM
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
-else
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
-endif
 
 toollib_LIBRARIES = libm.a \
 	libc.a
-- 
2.43.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/2] libgloss: drop $(INCLUDES) when using $(AS)
  2023-12-04  7:03 ` [PATCH 1/2] Revert "Fix libgloss/newlib build to conditionally use top include dir" Mike Frysinger
@ 2023-12-04  7:03   ` Mike Frysinger
  0 siblings, 0 replies; 15+ messages in thread
From: Mike Frysinger @ 2023-12-04  7:03 UTC (permalink / raw)
  To: newlib

Since $(AS) is the assembler, passing it a list of preprocessor include
flags doesn't make much sense.  The files aren't preprocessed which means
`#include` lines aren't respected, and while it would affect `.include`
usage, we never use that, and it's extremely unlikely to change.  Plus,
it's extremely unlikely we'd have .s files in common places to include vs
contained entirely within a specific arch dir, and at that point, it can
be included directly (with no flags), or the arch can add the unique set
of include paths that it needs for itself.
---
 libgloss/config/default.mh    | 2 +-
 libgloss/config/ppc.mh        | 2 +-
 libgloss/epiphany/Makefile.in | 2 +-
 libgloss/hp74x/Makefile.in    | 2 +-
 libgloss/pru/Makefile.in      | 2 +-
 libgloss/spu/Makefile.in      | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh
index 81f0920f97a8..64dc02f05c64 100644
--- a/libgloss/config/default.mh
+++ b/libgloss/config/default.mh
@@ -14,7 +14,7 @@ AR_FLAGS = rc
 .C.o:
 	$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
 .s.o:
-	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+	$(AS) $(ASFLAGS_FOR_TARGET) $(ASFLAGS) -o $*.o $<
 
 #
 # GCC knows to run the preprocessor on .S files before it assembles them.
diff --git a/libgloss/config/ppc.mh b/libgloss/config/ppc.mh
index a3d157bb8fd7..d1bfd7588e55 100644
--- a/libgloss/config/ppc.mh
+++ b/libgloss/config/ppc.mh
@@ -18,7 +18,7 @@ AR_FLAGS = qc
 .C.o:
 	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) -O2 $(INCLUDES) -c $(CFLAGS) $<
 .s.o:
-	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+	$(AS) $(ASFLAGS_FOR_TARGET) $(ASFLAGS) -o $*.o $<
 
 #
 # GCC knows to run the preprocessor on .S files before it assembles them.
diff --git a/libgloss/epiphany/Makefile.in b/libgloss/epiphany/Makefile.in
index 6cf55e25e69e..6670b79a08f1 100644
--- a/libgloss/epiphany/Makefile.in
+++ b/libgloss/epiphany/Makefile.in
@@ -105,7 +105,7 @@ AR_FLAGS = qc
 .S.o:
 	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $(CFLAGS) $<
 .s.o:
-	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+	$(AS) $(ASFLAGS_FOR_TARGET) $(ASFLAGS) -o $*.o $<
 
 #
 # GCC knows to run the preprocessor on .S files before it assembles them.
diff --git a/libgloss/hp74x/Makefile.in b/libgloss/hp74x/Makefile.in
index 12c51bf3bee7..0167e1c62ee3 100644
--- a/libgloss/hp74x/Makefile.in
+++ b/libgloss/hp74x/Makefile.in
@@ -117,7 +117,7 @@ install:
 
 .s.o:
 	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
-#	$(AS) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
+#	$(AS) $(CFLAGS_FOR_TARGET) -c $<
 
 .SUFFIXES: .S .c .o .s .lif
 #
diff --git a/libgloss/pru/Makefile.in b/libgloss/pru/Makefile.in
index 7a2f290a827c..fc5905a5eaf4 100644
--- a/libgloss/pru/Makefile.in
+++ b/libgloss/pru/Makefile.in
@@ -89,7 +89,7 @@ LDFLAGS_FOR_TARGET = ${MULTILIB}
 .C.o:
 	$(CC) $(CFLAGS_FOR_TARGET) -Os $(INCLUDES) -c $(CFLAGS) $<
 .s.o:
-	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+	$(AS) $(ASFLAGS_FOR_TARGET) $(ASFLAGS) -o $*.o $<
 
 #
 # GCC knows to run the preprocessor on .S files before it assembles them.
diff --git a/libgloss/spu/Makefile.in b/libgloss/spu/Makefile.in
index bc8768baf183..4be0783b9873 100644
--- a/libgloss/spu/Makefile.in
+++ b/libgloss/spu/Makefile.in
@@ -95,7 +95,7 @@ AR_FLAGS = qc
 .C.o:
 	$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
 .s.o:
-	$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+	$(AS) $(ASFLAGS_FOR_TARGET) $(ASFLAGS) -o $*.o $<
 
 #
 # GCC knows to run the preprocessor on .S files before it assembles them.
-- 
2.43.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-12-04  7:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06  0:48 Various libgloss problems after recent changes Jeff Law
2023-02-09 22:54 ` Jeff Johnston
2023-02-10 11:21   ` Richard Earnshaw
2023-02-10 16:54     ` Jeff Law
2023-02-21 21:39       ` Jeff Johnston
2023-02-22  7:16         ` Jeff Law
2023-02-22 16:20           ` Jeff Johnston
2023-02-22 16:40             ` Jeff Law
2023-02-22 17:54             ` Jeff Law
2023-02-22 18:06               ` Jeff Johnston
2023-02-10 17:16     ` Jeff Johnston
2023-12-04  6:49     ` Mike Frysinger
2023-02-10 16:52   ` Jeff Law
2023-12-04  7:03 ` [PATCH 1/2] Revert "Fix libgloss/newlib build to conditionally use top include dir" Mike Frysinger
2023-12-04  7:03   ` [PATCH 2/2] libgloss: drop $(INCLUDES) when using $(AS) Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).