public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jeff Johnston <jjohnstn@redhat.com>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>,
	Mike Frysinger <vapier@gentoo.org>,
	 newlib@sourceware.org
Subject: Re: Various libgloss problems after recent changes
Date: Tue, 21 Feb 2023 16:39:24 -0500	[thread overview]
Message-ID: <CAOox84vxLKSF-aPmdsf489tso3F6=R6pWcVqkTuzZi=tVKZLuQ@mail.gmail.com> (raw)
In-Reply-To: <9138400f-3819-2e46-fe64-bdab73b053d5@gmail.com>


[-- 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


  reply	other threads:[~2023-02-21 21:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06  0:48 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOox84vxLKSF-aPmdsf489tso3F6=R6pWcVqkTuzZi=tVKZLuQ@mail.gmail.com' \
    --to=jjohnstn@redhat.com \
    --cc=Richard.Earnshaw@foss.arm.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=newlib@sourceware.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).