This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Compiling gcc.3.0.4 for m68k-elf with C++-support




> -----Original Message-----
> From: Lau Sennels [mailto:v6421a@gjk.dk]
> Sent: Monday, May 06, 2002 1:14 PM
> To: kai.ruottu@luukku.com
> Cc: crossgcc@sources.redhat.com
> Subject: Re: Compiling gcc.3.0.4 for m68k-elf with C++-support
> 
> 
> 
> Hello Kai.
> 
> Kai Ruottu wrote:
> 
> >  When the 'vsprintf()' should be present in 'libc.a', there aren't a
> > reason to duplicate it in 'libiberty.a', so my workaround 
> has been to
> > remove it from the needed 'OBJS' (or something) in the Makefile(s).
> > First to edit one Makefile and make a diff between the original and
> > the edited one and to use the diff with 'patch' for the 
> others... This
> > takes totally a minute or less, so searching the bug in the 
> configure-
> > system hasn't been very interesting...
> 
> Thanks for your help. With a bit of tweaking it worked.
> 
> However, both m68k-elf-gcc and m68k-elf-g++ give linking-errors like
> these. (sorry if the line breaks have been messed up)
> 

You usually have to provide these function with your board support
package, that means you have to write them yourself. To make that a
little easier, there is the libgloss package in the newlib source
distribution which provide "dummy" functions which can be taken as a
starting point or even used unmodified if you dont't need the
functionality (for example: getpid() may return always 0 if you don't
have processes on your target).

If you have built the newlib for m68k, you should have the libgloss
already and you may try to add it to your linker command with -l. At
least the undefined references should then go away.

Wolfgang

> [sennels@src]$ m68k-elf-g++ test.cc
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/bin/ld:
> warning: cannot find entry symbol _start; defaulting to 80000080
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libstdc++.a(pure.o):
> In function `__cxa_pure_virtual':
> /home/sennels/src/tools/build-gcc/m68k-elf/libstdc++-v3/libsup
> c++/../../../../gcc-3.0.4/libstdc++-v3/libsupc++/pure.cc:49:
> undefined reference to `write'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(abort.o):
> In function `abort':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/stdl
> ib/../../../../../newlib-1.10.0/newlib/libc/stdlib/abort.c:63:
> undefined reference to `_exit'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(fstatr.o):
> In function `_fstat_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/fstatr.c:62:
> undefined reference to `fstat'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(makebuf.o):
> In function `__smakebuf':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/stdi
> o/../../../../../newlib-1.10.0/newlib/libc/stdio/makebuf.c:93:
> undefined reference to `isatty'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(openr.o):
> In function `_open_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/openr.c:59:
> undefined reference to `open'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(sbrkr.o):
> In function `_sbrk_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/sbrkr.c:60:
> undefined reference to `sbrk'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(signalr.o):
> In function `_kill_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/signalr.c:61:
> undefined reference to `kill'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(signalr.o):
> In function `_getpid_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/signalr.c:96:
> undefined reference to `getpid'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(writer.o):
> In function `_write_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/writer.c:58:
> undefined reference to `write'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(closer.o):
> In function `_close_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/closer.c:53:
> undefined reference to `close'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(lseekr.o):
> In function `_lseek_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/lseekr.c:58:
> undefined reference to `lseek'
> /home/sennels/src/tools/lib/gcc-lib/m68k-elf/3.0.4/../../../..
> /m68k-elf/lib/libc.a(readr.o):
> In function `_read_r':
> /home/sennels/src/tools/build-newlib/m68k-elf/newlib/libc/reen
> t/../../../../../newlib-1.10.0/newlib/libc/reent/readr.c:58:
> undefined reference to `read'
> collect2: ld returned 1 exit status
> ------------------
> PREFIX=/home/erik/src
> TARGET=m68k-elf
> 
> The program looks like this, and (of course) links normally 
> on my native
> compiler. Specifying libstdc++.a and includes doesn't help. It seems
> the problem is in the newlib libc. I did not specify --enable-threads,
> but still it uses the reentrant libc-code version. It also refers to
> my build-newlib directory. Is that the correct configuration?
> 
> #include<iostream>
> #include<vector>
> 
> using namespace std;
> 
> int main()
> {
>  int i;
>  vector<int> ivec;
>  ivec.push_back(i);
>  return 0;
> }
> 
> -- 
>  use PDL; use PDL::IO::Pic;$a=zeroes 300,300; 
> $r=$a->xlinvals(-1.5,0.5);
>  $i=$a->ylinvals(-1,1);$t=$r;$u=$i;for(1..30){$q=$r**2-$i**2+$t;
>  $h=2*$r*$i+$u;$d=$r**2+$i**2;$a=lclip($a,$_*($d>2.0)*($a==0));
>  ($r,$i)=map{$_->clip(-5,5)}($q,$h);}$a->wpic("mandelbrot.gif");
> 
> ------
> Want more information?  See the CrossGCC FAQ, 
http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to
crossgcc-unsubscribe@sources.redhat.com


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]