it worked !

( I had to removed references to the "dwarf" stuff however. )

Thanks alot. This helps greatly

wr

++++++++++++++++++++


Solaris compiles it's dmods with the following GCC invocation:

/usr/sfw/bin/gcc -fident -finline -fno-inline-functions -fno-builtin
-fno-asm \
    -nodefaultlibs -D__sun -fno-strict-aliasing -fno-unit-at-a-time
    -fno-optimize-sibling-calls -O2 -m64 -mtune=opteron -Ui386 -U__i386
    -Wall -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare
    -Wno-parentheses -Wno-uninitialized
-Wno-implicit-function-declaration
    -Wno-unused -Wno-trigraphs -Wno-char-subscripts -Wno-switch -Werror
    -std=gnu89 -gdwarf-2 -std=gnu89 -fno-dwarf2-indirect-strings -fPIC
    -DTEXT_DOMAIN="SUNW_OST_OSCMD" -D_TS_ERRNO -D_ELF64 -D_KERNEL
    -ffreestanding -c -o test.o test.c

(I'm sure that many of these options aren't needed)

And then links it with:

/usr/sfw/bin/gcc -fident -finline -fno-inline-functions -fno-builtin
-fno-asm
    -nodefaultlibs -D__sun -fno-strict-aliasing -fno-unit-at-a-time
    -fno-optimize-sibling-calls -O2 -m64 -mtune=opteron -Ui386 -U__i386
-Wall
    -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare
-Wno-parentheses
    -Wno-uninitialized -Wno-implicit-function-declaration -Wno-unused
-Wno-trigraphs
    -Wno-char-subscripts -Wno-switch -Werror -std=gnu89 -gdwarf-2
-std=gnu89
    -fno-dwarf2-indirect-strings -DTEXT_DOMAIN="SUNW_OST_OSCMD"
-D_TS_ERRNO
    -D_ELF64 -D_KERNEL -ffreestanding -Wl,-Bdirect -shared test.o -o
test.so

Do these work for you?

Cheers,
- jonathan


-----Original Message-----
From: Jonathan Adams [mailto:jonathan.ad...@sun.com] 
Sent: Friday, February 20, 2009 5:30 PM
To: William Reich
Cc: Dmitry.Samersoff at sun.com; mdb-discuss at opensolaris.org; Richmond
Tuttle
Subject: Re: [mdb-discuss] mdb dmod - compile with gcc on x86 ?

On Fri, Feb 20, 2009 at 05:08:46PM -0500, William Reich wrote:
>  
> 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


Reply via email to