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 ...

Reply via email to