Hi Sheldon,

On Tue, Jun 06, 2000 at 06:12:01PM -0500, Sheldon Hoffman wrote:
> <To [EMAIL PROTECTED]>
> 
> We are using Red Hat 6.1 on a pentium 233 Mhz with
> Linux version 2.2.14-rtl2.2 (gcc version egcs-2.91.66
> 19990314/Linux (egcs-1.1.2 release)) #4 Sat May 20 08:52:04 CDT 2000
> 
> We are hoping to build a single loadable (INSMOD module compatible)
> object module for RTLinux.  The project consists of many (> 50) .C
> files and associated .H files.
> 
> We plan to use MAKE to compile each .C + .H file separately to a .O
> file then build the final .O loadable module from all the individual
> .O files.
> 
> We can't figure out how to get GCC to accept a number of .O files
> and create a single .O file that can be loaded into RTLinux with INSMOD.
> 
> Can anyone suggest how we can build a single .O loadable module from
> many .O files that were individually compiled using GCC?

What you need is partial linking (ld -r). My own example follows:

ld -r ./obj/dspgm.mo ./obj/radic.mo ./obj/bankar.mo ./obj/insfil.mo 
./obj/ruovl.mo ./obj/kinem.mo ./obj/konst.mo ./obj/prmul.mo ./obj/invul.mo 
./obj/algeb.mo ./obj/affix.mo ./obj/chybnik.mo ./obj/vykfo.mo 
./obj/syntax.mo ./obj/sensor.mo ./obj/host.mo ./obj/declare.mo 
./obj/move.mo ./obj/inter.mo ./obj/synch.mo ./obj/begend.mo 
./obj/savloa.mo ./obj/ttdrv.mo ./obj/display.mo ./obj/tabul.mo 
-L/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66 -L/usr/lib -L../../libobjs 
-lmodn -lm -lgcc -M -o robol.m > ./maps/robol.m.map

where 

./obj/*.mo          are separately compiled objects (I use .mo instead of .O)
-L<something>       library path
-l<something>       name of the library to be linked with
robol.m             name of the loadable module (result of linking)
./maps/robol.m.map  name of the map        

Regards,

pa

..........................................................................
Pavel Andris                               | tel: +421 7 5941 2167
Institute of Control Theory and Robotics   | fax: +421 7 5477 6045
Slovak Academy of Sciences                 | 
Dubravska cesta 9                          | e-mail: [EMAIL PROTECTED]
SK - 842 37 Bratislava                     |
Slovakia                                   |
.........................................................................
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to