Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* needed-list fails in libiberty
@ 2009-04-14 14:10 Eli Zaretskii
  2009-04-14 14:19 ` Joseph S. Myers
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2009-04-14 14:10 UTC (permalink / raw)
  To: gcc, gcc-patches; +Cc: gdb-patches

The following snippet from libiberty/Makefile.in:

    # needed-list is used by libstdc++.  NEEDED is the list of functions
    # to include there.  Do not add anything LGPL to this list; libstdc++
    # can't use anything encumbering.
    NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
	     strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
	     vfork waitpid bcmp bcopy bzero
    needed-list: Makefile
	    rm -f needed-list; touch needed-list; \
	    for f in $(NEEDED); do \
	      for g in $(LIBOBJS) $(EXTRA_OFILES); do \
		case "$$g" in \
		  *$$f*) echo $$g >> needed-list ;; \
		esac; \
	      done; \
	    done

assumes that either $(LIBOBJS) or $(EXTRA_OFILES), or both, will be
non-empty.  If that assumption is wrong, building libiberty fails:

    rm -f needed-list; touch needed-list; \
    for f in atexit calloc memchr memcmp memcpy memmove memset rename strchr strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf vfork waitpid bcmp bcopy bzero; do \
      for g in  ; do \
	case "$g" in \
	  *$f*) echo $g >> needed-list ;; \
	esac; \
      done; \
    done
    d:\usr\tmp/dj850000: line 1: syntax error near unexpected token `;'

This was in a DJGPP build of GDB, and the root cause of $(LIBOBJS)
being empty was another bug (see my other mail today about "libiberty
configuration for DJGPP").  But in principle, some build that has all
of the required functions in the system library can potentially fail
in the same way, no?

So how about the following patch?

2009-04-14  Eli Zaretskii  <eliz@gnu.org>

	* Makefile.in (needed-list): Add "notused" to the list of the
	inner `for', to avoid failure when both $(LIBOBJS) and
	$(EXTRA_OFILES) are empty.


--- libiberty/Makefile.i~0	2009-03-28 05:07:29.000000000 +0300
+++ libiberty/Makefile.in	2009-04-11 12:27:37.284000000 +0300
@@ -383,10 +383,12 @@
 NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
 	 strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
 	 vfork waitpid bcmp bcopy bzero
+# The notused gork is for when both LIBOBJS and EXTRA_OFILES end up
+# empty: the for loop will then barf.
 needed-list: Makefile
 	rm -f needed-list; touch needed-list; \
 	for f in $(NEEDED); do \
-	  for g in $(LIBOBJS) $(EXTRA_OFILES); do \
+	  for g in $(LIBOBJS) $(EXTRA_OFILES) notused; do \
 	    case "$$g" in \
 	      *$$f*) echo $$g >> needed-list ;; \
 	    esac; \


^ permalink raw reply	[flat|nested] 13+ messages in thread
* needed-list fails in libiberty
@ 2009-04-14 14:10 Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2009-04-14 14:10 UTC (permalink / raw)
  To: gcc, gcc-patches; +Cc: gdb-patches

The following snippet from libiberty/Makefile.in:

    # needed-list is used by libstdc++.  NEEDED is the list of functions
    # to include there.  Do not add anything LGPL to this list; libstdc++
    # can't use anything encumbering.
    NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
	     strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
	     vfork waitpid bcmp bcopy bzero
    needed-list: Makefile
	    rm -f needed-list; touch needed-list; \
	    for f in $(NEEDED); do \
	      for g in $(LIBOBJS) $(EXTRA_OFILES); do \
		case "$$g" in \
		  *$$f*) echo $$g >> needed-list ;; \
		esac; \
	      done; \
	    done

assumes that either $(LIBOBJS) or $(EXTRA_OFILES), or both, will be
non-empty.  If that assumption is wrong, building libiberty fails:

    rm -f needed-list; touch needed-list; \
    for f in atexit calloc memchr memcmp memcpy memmove memset rename strchr strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf vfork waitpid bcmp bcopy bzero; do \
      for g in  ; do \
	case "$g" in \
	  *$f*) echo $g >> needed-list ;; \
	esac; \
      done; \
    done
    d:\usr\tmp/dj850000: line 1: syntax error near unexpected token `;'

This was in a DJGPP build of GDB, and the root cause of $(LIBOBJS)
being empty was another bug (see my other mail today about "libiberty
configuration for DJGPP").  But in principle, some build that has all
of the required functions in the system library can potentially fail
in the same way, no?

So how about the following patch?

2009-04-14  Eli Zaretskii  <eliz@gnu.org>

	* Makefile.in (needed-list): Add "notused" to the list of the
	inner `for', to avoid failure when both $(LIBOBJS) and
	$(EXTRA_OFILES) are empty.


--- libiberty/Makefile.i~0	2009-03-28 05:07:29.000000000 +0300
+++ libiberty/Makefile.in	2009-04-11 12:27:37.284000000 +0300
@@ -383,10 +383,12 @@
 NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
 	 strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
 	 vfork waitpid bcmp bcopy bzero
+# The notused gork is for when both LIBOBJS and EXTRA_OFILES end up
+# empty: the for loop will then barf.
 needed-list: Makefile
 	rm -f needed-list; touch needed-list; \
 	for f in $(NEEDED); do \
-	  for g in $(LIBOBJS) $(EXTRA_OFILES); do \
+	  for g in $(LIBOBJS) $(EXTRA_OFILES) notused; do \
 	    case "$$g" in \
 	      *$$f*) echo $$g >> needed-list ;; \
 	    esac; \


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

end of thread, other threads:[~2009-04-26 17:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-14 14:10 needed-list fails in libiberty Eli Zaretskii
2009-04-14 14:19 ` Joseph S. Myers
2009-04-14 14:42   ` Eli Zaretskii
2009-04-15  0:30     ` Ian Lance Taylor
2009-04-15  8:15       ` Eli Zaretskii
2009-04-15 13:50         ` Ian Lance Taylor
2009-04-16 17:47           ` Eli Zaretskii
2009-04-25  9:58             ` Eli Zaretskii
2009-04-25 22:41               ` Ian Lance Taylor
2009-04-26 17:44                 ` Eli Zaretskii
2009-04-26  2:23               ` DJ Delorie
2009-04-26 17:44                 ` Eli Zaretskii
2009-04-14 14:10 Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox