pc386 - hello world linker problem

Ralf Corsepius ralf_corsepius at rtems.org
Tue Nov 9 16:38:31 UTC 2004


On Mon, 2004-11-08 at 23:36, Lars Munch wrote:
> Hello
> 
> I have been playing a bit with bochs and added a small contribution
> about creating FAT32 hard disk images for bochs to the wiki. Now its
> time to actually build "hello world" for pc386 myself to run in bochs,
> but due to a linker error I have not had any success on this part yet.
> 
> I am using:
> binutils-2.13.2.1-rtems-20030901.diff
> binutils-2.13.2.1.tar.bz2
> gcc-3.2.3-rtems-20040420.diff
> gcc-3.2.3.tar.bz2
> newlib-1.11.0-rtems-20031113.diff
> newlib-1.11.0.tar.gz
> 
> Binutils is configured with:
> # configure --target=i386-rtems --prefix=/opt/rtems/i386-rtems
> 
> Gcc is configured with:
> # configure --target=i386-rtems --prefix=/opt/rtems/i386-rtems \
>   --with-gnu-as --with-gnu-ld --with-newlib --verbose --enable-threads \
>   --enable-languages="c,c++"
> 
> RTEMS from cvs HEAD is configured with:
> # configure --target=i386-rtems --enable-rtemsbsp=pc386 \
>   --prefix=/opt/rtems/i386-rtems --disable-cxx --disable-itron \
>   --enable-posix --disable-tests
> 
> Now building examples/hello_world_c gives the following:
> 
> test -d o-optimize || mkdir o-optimize
> i386-rtems-gcc --pipe -B/opt/rtems/i386-rtems/i386-rtems/pc386/lib/
> -specs bsp_specs -qrtems   -g -Wall  -O4 -g         -c   -o
> o-optimize/test.o test.c
> In file included from test.c:31:
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/include/confdefs.h:4:2:
> warning: #warning <confdefs.h> is deprecated, use <rtems/confdefs.h>
> instead
> i386-rtems-gcc --pipe -B/opt/rtems/i386-rtems/i386-rtems/pc386/lib/
> -specs bsp_specs -qrtems   -g -Wall  -O4 -g
> -Wl,-Ttext,0x00100000 -o o-optimize/hello.obj  o-optimize/test.o
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-dpmem.rel
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-event.rel
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-msg.rel
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-mp.rel
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-part.rel
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-signal.rel
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-timer.rel
> /opt/rtems/i386-rtems/i386-rtems/pc386/lib/no-rtmon.rel     
> /opt/rtems/i386-rtems/lib/gcc-lib/i386-rtems/3.2.3/../../../../i386-rtems/bin/ld:
> cannot open linker script file c: No such file or directory
> collect2: ld returned 1 exit status
> make: *** [o-optimize/hello.exe] Error 1
> 
> This is my first time using RTEMS for i386, so any pointer are highly
> appreciated.
The cause for this breakdown is a typo in RTEMS gcc-patch, which had
been reported and fixed looong time ago. Unfortunately it still seems to
be contained in RTEMS current toolchain.


As a work around, check your
/opt/rtems-4.6/lib/gcc-lib/i386-rtems/3.2.3/specs

for the "lib:"-rule and edit -gcc into -lgcc in this line.


--- /opt/rtems-4.6/lib/gcc-lib/i386-rtems/3.2.3/specs~  2004-10-27 16:43:43.000000000 +0200
+++ /opt/rtems-4.6/lib/gcc-lib/i386-rtems/3.2.3/specs   2004-10-27 16:43:43.000000000 +0200
@@ -45,7 +45,7 @@
  
  
 *lib:
-%{!qrtems: %{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}} %{!nostdlib: %{qrtems: --start-group  %{!qrtems_debug: -lrtemsbsp -lrtemscpu}  %{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g}  -lc -gcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}
+%{!qrtems: %{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}} %{!nostdlib: %{qrtems: --start-group  %{!qrtems_debug: -lrtemsbsp -lrtemscpu}  %{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g}  -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}
  
 *libgcc:
 -lgcc


<ranting>
Joel, when will this bug finally be fixed?
</ranting>

Ralf





More information about the users mailing list