Joe Smith wrote:
>
> >From the rtl archives...
>
> Phil Wilshire <[EMAIL PROTECTED]> wrote:
> > I am working on either including
> > /usr/lib/gcc-lib/i386-glibc20-linux/egcs-2.90.29/libgcc.a in my links
> > or getting the code out of egcs and using that.
>
> I just ran into this same problem and found this little trick:
>
> File: gcc.info, Node: Debugging Options, ...
> ...
> `-print-libgcc-file-name'
> Same as `-print-file-name=libgcc.a'.
>
> This is useful when you use `-nostdlib' or `-nodefaultlibs' but
> you do want to link with `libgcc.a'. You can do
>
> gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
>
> So,
>
> ld -r module.o.tmp -o module.o `gcc -print-libgcc-file-name`
>
> will link with libgcc in a system-independent manner.
>
> Has anyone looked at the code from libgcc? It shouldn't be hard to
> reproduce the code in an inline function. It comes up often due to the
> 64-bit RTIME values, so maybe it would be appropriate to include in
> rtlinux proper.
>
THis seemed to work
my code
/* $Id: simple.c,v 1.2 1999/10/20 08:10:07 wilshire Exp $ */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
int mmival = 21;
int init_module(void) {
long long int li1;
long long int li2;
int x;
li1 = 32LL;
li2 = 2LL;
x = li1 /li2 ;
printk("simple hello mmival = %d\n",mmival);
return 0;
}
int cleanup_module(void) {
printk("simple bye.. mmival = %d\n",mmival);
return;
}
===================
my makefile
CFLAGS= -O2 -D__KERNEL__ -DMODULE
simpledd.o : simpledd.c
cc -c $(CFLAGS) simpledd.c -o simpledd_tmp.o
ld -r simpledd_tmp.o -o simpledd.o `gcc -print-libgcc-file-name`
======================
my results
-- this failed
[root@vmedev4 code]# insmod simpledd_tmp.o
__divdi3 undefined
Loading failed! The module symbols (from linux-2.0.34) don't match your
linux-2.0.34
--- this worked
[root@vmedev4 code]# insmod simpledd.o
[root@vmedev4 code]#
=======================
code sizes OLD 4.2 system
[root@vmedev4 code]# ls -l simpledd*.o
-rw-rw-r-- 1 root root 4652 Nov 19 16:00 simpledd.o
-rw-rw-r-- 1 root root 1104 Nov 19 16:00 simpledd_tmp.o
===============================
RH 6.0
[root@pasrack3 code]# ls -l
total 21
-rw-rw-r-- 1 wilshire wilshire 174 Nov 19 16:07 Makefile
-rw-rw-r-- 1 wilshire wilshire 443 Nov 19 16:04 simpledd.c
-rw-rw-r-- 1 root root 15561 Nov 19 16:07 simpledd.o
-rw-rw-r-- 1 root root 1240 Nov 19 16:07 simpledd_tmp.o
again some results
[root@pasrack3 code]# insmod simpledd_tmp.o
simpledd_tmp.o: unresolved symbol __divdi3
[root@pasrack3 code]# insmod simpledd.o
[root@pasrack3 code]#
Total sucess on this one.
Remember once the symbol is in there other modules can use it.
Cool stuff.
Phil
--- [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/