I built a fresh/up-to-date Sol 10 Update 6 x86 disk. I installed the Sun Studio 12 compiler.
I still can not get the mdb dmod file to load. We downloaded and installed this Sun compiler. I still get errors... uname -a SunOS bart 5.10 Generic_138889-03 i86pc i386 i86pc /opt/SUNWspro/bin/cc \ -DOMNI_UNIX -D_KERNEL -DMP_SSRV4 -DAMD64_ARCH -DSOL10 \ -I. -I.. \ -I/usr/X/include \ -std=gnu99 -O -DAMD64_ARCH -o test.so test.c \ -m64 -fPIC -D_KERNEL -Xlinker "-G" ot at bart 18% mdb -k Loading modules: [ unix krtld genunix specfs dtrace cpu.generic cpu_ms.AuthenticAMD.15 uppc pcplusmp ufs ip hook neti sctp arp usba s1394 nca lofs fctl audiosup zfs cpc random crypto fcip logindmux ptm sppp nfs ipc ] > ::load ./test.so mdb: ld.so.1: mdb: fatal: relocation error: R_AMD64_PC32: file ./test.so: symbol _init: value 0x28001e6665d does not fit > $q ...the Sun Studio 12 compiler. Its a free download .... Please see: http://developers.sun.com/sunstudio/downloads/index.jsp wr -----Original Message----- From: Dmitry.Samersoff at Sun.COM [mailto:dmitry.samers...@sun.com] Sent: Friday, February 20, 2009 10:49 AM To: William Reich Cc: mdb-discuss at opensolaris.org; Richmond Tuttle Subject: Re: mdb dmod - compile with gcc on x86 ? William, I found it: http://bugs.opensolaris.org/bugdatabase/view_bug.do;jsessionid=a68c8de18 7c30929fb79755edd017?bug_id=5102797 So you probably will have to download mdb code and build whole kmdb with your extension ... -Dmitry. William Reich wrote: > > This did not work either... > > /bin/gcc -L/vob/signalware/Master/library \ > -fno-builtin -DOMNI_UNIX -D_KERNEL -DMP_SSRV4 -DAMD64_ARCH -DSOL10 \ > -I/vob/common/src -I/vob/signalware/../common/src \ > -I. -I.. -I/vob/signalware//Master/Ft/inc > -I/vob/signalware//Master/Ft/inc \ > -I/vob/signalware//Master/cust_inc > -I/vob/signalware//Master/cust_inc > \ > -I/vob/signalware//Master/priv_inc > -I/vob/signalware//Master/priv_inc > \ > -I../../../../libulcm/inc -I../../include -I/usr/X/include \ > -Wall -std=gnu99 -O -DAMD64_ARCH -o mr_mdb.so mr_mdb.c \ > -m64 -fPIC -D_KERNEL -Xlinker "-G" > > # uname -a > SunOS wally 5.10 Generic_137112-07 i86pc i386 i86pc # # mdb -k Loading > modules: [ unix krtld genunix specfs dtrace cpu.generic > cpu_ms.AuthenticAMD.15 uppc pcplusmp ufs mpt ip hook neti sctp arp > 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 0x28001df99e4 does not fit >> $q > > > -----Original Message----- > From: Dmitry.Samersoff at Sun.COM [mailto:Dmitry.Samersoff at Sun.COM] > Sent: Thursday, February 19, 2009 5:08 PM > To: William Reich > Cc: mdb-discuss at opensolaris.org; Richmond Tuttle > Subject: Re: mdb dmod - compile with gcc on x86 ? > > William, > > You definitely don't need -G key for compiler and probably don't need > -mcmodel in this case. > > So try: > -m64 -fPIC -Xlinker "-G" -D_KERNEL > > > William Reich wrote: >> we use gcc on sparc as well. >> This mdb module compiles and works fine with gcc & sparc. >> >> When I add -shared on the x86 platform, I get... >> >> /bin/gcc -L/vob/signalware/Master/library -m64 -fno-builtin >> -DOMNI_UNIX -D_KERNEL -DMP_SSRV4 -DAMD64_ARCH -DSOL10 > -I/vob/common/src >> -I/vob/signalware/../common/src -I. -I.. >> -I/vob/signalware//Master/Ft/inc -I/vob/signalware//Master/Ft/inc >> -I/vob/signalware//Master/cust_inc -I/vob/signalware//Master/cust_inc >> -I/vob/signalware//Master/priv_inc -I/vob/signalware//Master/priv_inc >> -I../../../../libulcm/inc -I../../include -I/usr/X/include -Wall >> -std=gnu99 -O -DAMD64_ARCH -o mr_mdb.so mr_mdb.c -G -shared >> -mno-red-zone -mcmodel=kernel >> Text relocation remains referenced >> against symbol offset in file >> <unknown> 0x20 /var/tmp//cckausVW.o >> <unknown> 0x50 /var/tmp//cckausVW.o >> <unknown> 0x80 /var/tmp//cckausVW.o >> <unknown> 0xa8 /var/tmp//cckausVW.o >> <unknown> 0x860 /var/tmp//cckausVW.o >> <unknown> 0x870 /var/tmp//cckausVW.o >> <unknown> 0x878 /var/tmp//cckausVW.o >> <unknown> 0x888 /var/tmp//cckausVW.o >> <unknown> 0x898 /var/tmp//cckausVW.o >> <unknown> 0x8a0 /var/tmp//cckausVW.o >> . >> . >> . >> mdb_printf 0x3a6 /var/tmp//cckausVW.o >> mdb_printf 0x3e4 /var/tmp//cckausVW.o >> mdb_printf 0x3ff /var/tmp//cckausVW.o >> mdb_printf 0x417 /var/tmp//cckausVW.o >> mdb_printf 0x432 /var/tmp//cckausVW.o >> mdb_printf 0x44d /var/tmp//cckausVW.o >> mdb_printf 0x468 /var/tmp//cckausVW.o >> mdb_printf 0x483 /var/tmp//cckausVW.o >> mdb_printf 0x50e /var/tmp//cckausVW.o >> mdb_printf 0x529 /var/tmp//cckausVW.o >> mdb_printf 0x545 /var/tmp//cckausVW.o >> mdb_printf 0x560 /var/tmp//cckausVW.o >> mdb_printf 0x57c /var/tmp//cckausVW.o >> mdb_printf 0x597 /var/tmp//cckausVW.o >> mdb_printf 0x5b3 /var/tmp//cckausVW.o >> mdb_printf 0x5cf /var/tmp//cckausVW.o >> mdb_printf 0x5e0 /var/tmp//cckausVW.o >> ld: fatal: relocations remain against allocatable but non-writable >> sections >> collect2: ld returned 1 exit status >> >> -----Original Message----- >> From: Dmitry.Samersoff at Sun.COM [mailto:Dmitry.Samersoff at Sun.COM] >> Sent: Thursday, February 19, 2009 1:30 PM >> To: William Reich >> Cc: Jonathan Adams; mdb-discuss at opensolaris.org; Richmond Tuttle >> Subject: Re: mdb dmod - compile with gcc on x86 ? >> >> William, >> >> Do you use gcc on sparc to build the module? >> What kind of unresolved symbols -shared cause? >> >> I think mdb has been build using Sun Studio compiler so it's better >> to > >> use Sun CC to build the module. >> >> -Dmitry. >> >> >> William Reich wrote: >>> >>> 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.Samersoff at 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 ... >> >> -- >> Dmitry Samersoff >> J2SE Sustaining team, SPB04 >> * There will come soft rains ... > > > -- > Dmitry Samersoff > J2SE Sustaining team, SPB04 > * There will come soft rains ... -- Dmitry Samersoff J2SE Sustaining team, SPB04 * There will come soft rains ...