Re: [rtl] Many .O files to one loadable .O module with GCC?
Hi Sheldon, On Tue, Jun 06, 2000 at 06:12:01PM -0500, Sheldon Hoffman wrote: > > > 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 library path -l 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 " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
Re: [rtl] Many .O files to one loadable .O module with GCC?
On Tue, Jun 06, 2000 at 06:12:01PM -0500, Sheldon Hoffman wrote: > > > 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? > ld -r -o big.o small1.o small2.o It is important, however, to make sure that small1.o and small2.o are compiled with the correct flags and that the .c files include the correct header files. Looking at the output of 'make modules' while compiling a kernel and watching the details really helps. The sound drivers are especially useful. dave... -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
Re: [rtl] Many .O files to one loadable .O module with GCC?
Why don't you peek the Rules.make of kernel source package ? You can use 'ld' to make a single loadable object from many 'o' files. Let me give you an example. If you are trying to build a module named 'mymodule.o' with 'object1.o', 'object2.o', and 'object3.o' then the following command can be used. ld -r -o module.o object1.o object2.o object3.o Bye. - Original Message - From: "Sheldon Hoffman" <[EMAIL PROTECTED]> To: "rtlinux" <[EMAIL PROTECTED]> Sent: Wednesday, June 07, 2000 8:12 AM Subject: [rtl] Many .O files to one loadable .O module with GCC? > > > 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? > > ___ > Shel Hoffman > St. Louis, MO 63132 USA > (314) 993-6132 voice > (314) 993-3316 fax > [EMAIL PROTECTED] > > > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > echo "unsubscribe rtl " | mail [EMAIL PROTECTED] > --- > For more information on Real-Time Linux see: > http://www.rtlinux.org/rtlinux/ > -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
[rtl] Many .O files to one loadable .O module with GCC?
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? ___ Shel Hoffman St. Louis, MO 63132 USA (314) 993-6132 voice (314) 993-3316 fax [EMAIL PROTECTED] -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/