From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31000 invoked by alias); 14 Apr 2009 14:10:52 -0000 Received: (qmail 30391 invoked by uid 22791); 14 Apr 2009 14:10:44 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=AWL,BAYES_50,LONGWORDS,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout5.012.net.il (HELO mtaout5.012.net.il) (84.95.2.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Apr 2009 14:10:42 +0000 Received: from conversion-daemon.i_mtaout5.012.net.il by i_mtaout5.012.net.il (HyperSendmail v2004.12) id <0KI300800GM0WK00@i_mtaout5.012.net.il> for gdb-patches@sources.redhat.com; Tue, 14 Apr 2009 17:10:36 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.229.34.97]) by i_mtaout5.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KI300M9TGPIW970@i_mtaout5.012.net.il>; Tue, 14 Apr 2009 17:10:36 +0300 (IDT) Date: Tue, 14 Apr 2009 14:10:00 -0000 From: Eli Zaretskii Subject: needed-list fails in libiberty To: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: gdb-patches@sources.redhat.com Reply-to: Eli Zaretskii Message-id: <83vdp7mile.fsf@gnu.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00250.txt.bz2 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 * 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; \