Bug 10957 - m68k-cross build broken in libiberty (hashtab.c)
Summary: m68k-cross build broken in libiberty (hashtab.c)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.3
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2003-05-23 19:12 UTC by randy.rude
Modified: 2004-04-21 02:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: m68k-elf
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-05-31 18:32:44


Attachments
Copy of the initial bug report. (932 bytes, text/plain)
2003-05-23 19:24 UTC, randy.rude
Details
libiberty patch (578 bytes, patch)
2003-06-04 10:06 UTC, Dara Hazeghi
Details | Diff
native build script (459 bytes, text/plain)
2003-07-02 19:46 UTC, randy.rude
Details
m68k cross build script (537 bytes, text/plain)
2003-07-02 19:47 UTC, randy.rude
Details

Note You need to log in before you can comment on or make changes to this bug.
Description randy.rude 2003-05-23 19:12:47 UTC
Build of a m68k-cross compiler fails with the following error:    G_H -O2 -g -O2 -I. -I../../../gcc/libiberty/../include  -W -Wall -Wtraditional  -pedantic ../../../gcc/libiberty/hashtab.c -o hashtab.o  ../../../gcc/libiberty/hashtab.c: In function `higher_prime_number':  ../../../gcc/libiberty/hashtab.c:133: warning: implicit declaration of  function `abort'  ../../../gcc/libiberty/hashtab.c: In function `htab_create':  ../../../gcc/libiberty/hashtab.c:204: error: `free' undeclared (first use in  this function)  ../../../gcc/libiberty/hashtab.c:204: error: (Each undeclared identifier is  reported only once  ../../../gcc/libiberty/hashtab.c:204: error: for each function it appears in.)  ../../../gcc/libiberty/hashtab.c: In function `htab_try_create':  ../../../gcc/libiberty/hashtab.c:214: error: `calloc' undeclared (first use in  this function)  ../../../gcc/libiberty/hashtab.c:214: error: `free' undeclared (first use in  this function)  make[1]: *** [hashtab.o] Error 1  make[1]: Leaving directory  `/home/rrude/src/gnu/build-m68k-gcc/m68k-elf/libiberty'  make: *** [all-target-libiberty] Error 2    This failure is also present in GCC 3.3: http://gcc.gnu.org/ml/gcc/2003-05/msg01930.html  native gcc -v: Reading specs from /home/rrude/tools/native/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs Configured with: ../gcc/configure --verbose --prefix=/home/rrude/tools/native --enable-languages=c,c++,ada,java Thread model: posix gcc version 3.3 20030407 (prerelease)  This trivial patch addresses the problem:  -- snip  diff -Nwupr gcc-20030407/libiberty/hashtab.c /home/rrude/src/gnu/gcc-20030407/libiberty/hashtab.c --- gcc-20030407/libiberty/hashtab.c    2003-01-20 11:41:47.000000000 -0700 +++ /home/rrude/src/gnu/gcc-20030407/libiberty/hashtab.c        2003-04-07 16:21:51.000000000 -0600 @@ -46,6 +46,7 @@ Boston, MA 02111-1307, USA.  */  #endif   #include <stdio.h> +#include <malloc.h>   #include "libiberty.h"  #include "hashtab.h"  -- snip  This patch was submitted to gcc-patches: http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00726.html  and a better solution was requested.  It's unlikely I will be able to supply the requested changes anytime soon.
Comment 1 randy.rude 2003-05-23 19:24:20 UTC
Created attachment 4062 [details]
Copy of the initial bug report.

The initial report in bugzilla appears unreadable.
Comment 2 Andrew Pinski 2003-05-27 18:03:09 UTC
From the attachment:
Build of a m68k-cross compiler fails with the following error:  
  
G_H -O2 -g -O2 -I. -I../../../gcc/libiberty/../include  -W -Wall -Wtraditional  
-pedantic ../../../gcc/libiberty/hashtab.c -o hashtab.o  
../../../gcc/libiberty/hashtab.c: In function `higher_prime_number':  
../../../gcc/libiberty/hashtab.c:133: warning: implicit declaration of  
function `abort'  
../../../gcc/libiberty/hashtab.c: In function `htab_create':  
../../../gcc/libiberty/hashtab.c:204: error: `free' undeclared (first use in  
this function)  
../../../gcc/libiberty/hashtab.c:204: error: (Each undeclared identifier is  
reported only once  
../../../gcc/libiberty/hashtab.c:204: error: for each function it appears in.)  
../../../gcc/libiberty/hashtab.c: In function `htab_try_create':  
../../../gcc/libiberty/hashtab.c:214: error: `calloc' undeclared (first use in  
this function)  
../../../gcc/libiberty/hashtab.c:214: error: `free' undeclared (first use in  
this function)  
make[1]: *** [hashtab.o] Error 1  
make[1]: Leaving directory  
`/home/rrude/src/gnu/build-m68k-gcc/m68k-elf/libiberty'  
make: *** [all-target-libiberty] Error 2  
  
This failure is also present in GCC 3.3: 
http://gcc.gnu.org/ml/gcc/2003-05/msg01930.html 
 
native gcc -v: 
Reading specs from 
/home/rrude/tools/native/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs 
Configured with: ../gcc/configure --verbose --prefix=/home/rrude/tools/native 
--enable-languages=c,c++,ada,java 
Thread model: posix 
gcc version 3.3 20030407 (prerelease) 
 
This trivial patch addresses the problem: 
 
-- snip 
 
diff -Nwupr gcc-20030407/libiberty/hashtab.c 
/home/rrude/src/gnu/gcc-20030407/libiberty/hashtab.c 
--- gcc-20030407/libiberty/hashtab.c    2003-01-20 11:41:47.000000000 -0700 
+++ /home/rrude/src/gnu/gcc-20030407/libiberty/hashtab.c        2003-04-07 
16:21:51.000000000 -0600 
@@ -46,6 +46,7 @@ Boston, MA 02111-1307, USA.  */ 
 #endif 
 
 #include <stdio.h> 
+#include <malloc.h> 
 
 #include "libiberty.h" 
 #include "hashtab.h" 
 
-- snip 
 
This patch was submitted to gcc-patches: 
http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00726.html 
 
and a better solution was requested.  It's unlikely I will be able to supply 
the requested changes anytime soon. 
Comment 3 Dara Hazeghi 2003-05-31 18:32:44 UTC
This requires a configure.in fix which has yet to be written/submitted...

Dara
Comment 4 Dara Hazeghi 2003-06-04 10:06:17 UTC
Rudy,

I made a quick patch to configure.in to check for malloc.h. I've attached a patch for it. Is it possible 
for you to check whether the patch works (I don't have to necessary odds and ends for a full cross 
compile). All that should be needed is apply the patch, and then rerun autoconf and 
autoheader in that directory. Thanks,

Dara
Comment 5 Dara Hazeghi 2003-06-04 10:06:23 UTC
Created attachment 4162 [details]
libiberty patch
Comment 6 Dara Hazeghi 2003-06-04 10:07:23 UTC
Apologies, I meant Randy of course (that's what I get for doing this late at night...)
Comment 7 randy.rude 2003-06-06 18:07:47 UTC
Dara, your configure patch works for me (my system has malloc.h).  I can't 
test the non-malloc.h case. 
Comment 8 Dara Hazeghi 2003-06-08 02:40:47 UTC
Randy,

sorry to make another request, but it looks like there was a simpler fix someone found to a 
problem similar to this (PR 10331). Would it be possible for you to check whether just adding the 
line:
STMP_FIXPROTO =

to config/m68k/t-m68kelf fixes the problem? Thanks,

Dara
Comment 9 randy.rude 2003-06-11 16:42:42 UTC
Dara, I created the file config/m68k/t-m68kelf containing the line:   
STMP_FIXPROTO =   
   
and rebuilt.  This change did not fix the problem.  Is the filename correct?   
Comment 10 Dara Hazeghi 2003-06-11 18:09:06 UTC
Yup, that was the change. Okay, so I guess my original patch must have been closer. I'll send it off 
to the mailing list, and hopefully it (or something like it) will get in soon... Thanks for testing.

Dara
Comment 11 DJ Delorie 2003-06-19 19:06:13 UTC
I applied the configure patch to 3.3 and 3.4
Comment 12 Dara Hazeghi 2003-06-22 17:34:21 UTC
Randy,

I'm having problems reproducing this (without the malloc.h patch installed). Doing a build with gcc 
3.3, newlib 1.11.0 and binutils 2.14, I get no errors building a combined tree for m68k-elf. Can 
you describe how you configured, and what versions of newlib and binutils you used? Thanks,

Dara
Comment 13 randy.rude 2003-07-02 19:43:07 UTC
I just tried again with GCC 3.3, binutils 2.13, and newlib 1.11 (the same 
binutils and newlib as I reported originally).  I still see the problem while 
building the cross: 
 
../../../gcc/libiberty/hashtab.c: In function `higher_prime_number': 
../../../gcc/libiberty/hashtab.c:133: warning: implicit declaration of 
function `abort' 
../../../gcc/libiberty/hashtab.c: In function `htab_create': 
../../../gcc/libiberty/hashtab.c:204: error: `free' undeclared (first use in 
this function) 
../../../gcc/libiberty/hashtab.c:204: error: (Each undeclared identifier is 
reported only once 
../../../gcc/libiberty/hashtab.c:204: error: for each function it appears in.) 
../../../gcc/libiberty/hashtab.c: In function `htab_try_create': 
../../../gcc/libiberty/hashtab.c:214: error: `calloc' undeclared (first use in 
this function) 
../../../gcc/libiberty/hashtab.c:214: error: `free' undeclared (first use in 
this function) 
make[1]: *** [hashtab.o] Error 1 
make[1]: Leaving directory 
`/home/rrude/src/gnu/build-m68k-gcc/m68k-elf/libiberty' 
make: *** [all-target-libiberty] Error 2 
 
 
Comment 14 randy.rude 2003-07-02 19:46:32 UTC
Created attachment 4331 [details]
native build script

Here's my native build script.	I place links to the sources (gcc, newlib,
binutils) in the current dir and the ./native

lrwxrwxrwx    1 rrude	 rrude		14 Apr	9 13:04 binutils ->
binutils-2.13//
drwxr-xr-x   14 rrude	 rrude	      1312 Mar 27 09:39 binutils-2.13/
-rwxr--r--    1 rrude	 rrude	      1347 Apr 16 16:21 cross*
lrwxrwxrwx    1 rrude	 rrude		 8 Jul	2 09:53 gcc -> gcc-3.3//
drwxr-xr-x   17 rrude	 rrude	      1472 May 13 20:47 gcc-3.3/
-rwxr--r--    1 rrude	 rrude	       894 Apr 17 14:53 native*
lrwxrwxrwx    1 rrude	 rrude		14 Apr	9 13:05 newlib ->
newlib-1.11.0//
drwxr-xr-x    8 rrude	 rrude	      1432 Dec 20  2002 newlib-1.11.0/
Comment 15 randy.rude 2003-07-02 19:47:41 UTC
Created attachment 4332 [details]
m68k cross build script

See comments for the native build script.
Comment 16 Andrew Pinski 2003-07-02 19:52:35 UTC
tree-ssa is branch but you tried with 3.3 not with the tree-ssa branch.
Comment 17 Dara Hazeghi 2003-07-09 06:26:16 UTC
Hmm... Oddly enough I can't replicate this with newlib 1.11, binutils 2.13 and gcc 3.3 branch 
(without the malloc.h include in hashtab.c). Can you try with the 3.3 branch (after disabling the 
malloc.h include)?

Dara
Comment 18 Andrew Pinski 2003-08-01 04:46:40 UTC
Fixed for 3.4 by:
2003-06-19  Dara Hazeghi

        * configure.in: Add check for malloc.h needed by
        m68k for function free().
        * configure: Regenerated.
        * config.in: Add HAVE_MALLOC_H.
        * hashtab.c: include malloc.h were available for
        free().