on my compiler, -fPIC and -mcmodel=kernel are not allowed together. The -shared option resulted on lots of unresolved symbols.
The -Xlinker "-G" resulted in the same relocation error... I also tried the suggestion of Jonathan. Same relocation error... ( I would have thought a mdb module was a kernel module... ) wr +++++++++++++++++++++++++++++++++++ > >/bin/gcc -L/vob/signalware/Master/library -m64 -fno-builtin > >-DOMNI_UNIX \ > > -D_KERNEL -DMP_SSRV4 -mno-red-zone \ ^^^^^^^^^^^^^ > > -mcmodel=kernel -DAMD64_ARCH -DSOL10 \ ^^^^^^^^^^^^^^^ Those are your problem; this isn't a kernel module, so why are you using the kernel model? Cheers, - jonathan -----Original Message----- From: Dmitry.Samersoff at Sun.COM [mailto:dmitry.samers...@sun.com] Sent: Thursday, February 19, 2009 1:05 PM To: William Reich Cc: Bhaskar.Sarkar at Sun.COM; mdb-discuss at opensolaris.org; Richmond Tuttle Subject: Re: [mdb-discuss] mdb dmod - compile with gcc on x86 ? William, Try to change GCC command line: add -fPIC -shared and replace -G to -Xlinker "-G" William Reich wrote: > > my source does not contain a function named main(). > > ...only has the external function _mdb_init(). > All other functions in the file are static. > > wr > > -----Original Message----- > From: Bhaskar.Sarkar at Sun.COM [mailto:Bhaskar.Sarkar at Sun.COM] > Sent: Thursday, February 19, 2009 12:09 PM > To: William Reich > Cc: mdb-discuss at opensolaris.org; Richmond Tuttle > Subject: Re: [mdb-discuss] mdb dmod - compile with gcc on x86 ? > > William Reich wrote: >> >> I am trying to compile a dmod for mdb using gcc on a 64bit x86 >> machine. >> >> The compile goes ok, but the resulting file does not load into mdb. >> >> Anybody know the solution to this puzzle ? >> >> thanks >> >> wr > You should not have a main() function in your module. > Your only interface to mdb is via _mdb_init() > > HIH, > Bhaskar > >> ++++++++++++ >> >> >> /bin/gcc -L/vob/signalware/Master/library -m64 -fno-builtin >> -DOMNI_UNIX \ >> -D_KERNEL -DMP_SSRV4 -mno-red-zone \ -mcmodel=kernel -DAMD64_ARCH >> -DSOL10 \ >> -I/vob/common/src \ >> -Wall -std=gnu99 -O -G -o mr_mdb.so mr_mdb.c >> >> >> >> # mdb -k >> Loading modules: [ unix krtld genunix specfs dtrace cpu.generic >> cpu_ms.AuthenticAMD.15 uppc pcplusmp ufs mpt ip hook neti sctp a rp >> usba fcp fctl nca lofs md cpc random crypto zfs fcip logindmux ptm >> sppp nfs ipc ] >> >>> ::load ./mr_mdb.so >> mdb: ld.so.1: mdb: fatal: relocation error: R_AMD64_PC32: file >> ./mr_mdb.so: symbol main: value 0x28001df8e34 does not fit >> _______________________________________________ >> mdb-discuss mailing list >> mdb-discuss at opensolaris.org > > _______________________________________________ > mdb-discuss mailing list > mdb-discuss at opensolaris.org -- Dmitry Samersoff J2SE Sustaining team, SPB04 * There will come soft rains ...