I'm not sure, but I'll take a guess. I am also assuming that:
you are using /opt/SUNWspro/bin/cc for your compiler.
you are using a 32 bit address space
you are using a sparc chip
but you are not using a sparc v9
If those assumptions are correct, it looks like this might work...
cc -KPIC x.c
cc -KPIC y.c
cc -KPIC z.c
ld -G -Bdynamic -o libxyx.so x.o y.o z.o
I don't have a decent compiler on a 5.6 so I can't test this. But it's close. In your case, you say you have only a single module, so you would have only one cc. But that is very rare with a library. So I'm showing a more normal case where you would combine several modules into a library.
To generalize this more use on many versions on unix, you typically would use a makefile. The "-KPIC" would be in a variable so it could be changed as you moved from one version to another. Ditto for the "-G -Bdynamic".
This link is the
Linker and Libraries Guide, which you might want to look at. Also look at the man page for your compiler. Sun has several things called cc so you need to get the MANPATH right or you will be looking at the wrong one.
If this doesn't work, try replacing -KPIC with -Kpic.