[comp.sys.apollo] Position Independent Code and Xt library

obrian_n@maths.su.oz.au (Nigel O'Brian) (11/20/90)

I want to generate object modules containing Position 
Independent Code (PIC) for dynamic loading by the Domain 
loader. Usually this goes fine using cc -W0,-pic and 
ld -r -a -A noallres -A loadhigh. One can use 
/sys5.3/bin/dump -fv to check for the PIC flag on the output
file.

Problems start if one now wants to include a library in the
link step. Quick check of the stuff in /usr/lib/X11 shows that
libX11.a and libXt.a are not PIC. However, linking with libX11
still gives a PIC file, but linking with libXt gives a non-PIC
file. In fact NONE of the constituent files in libXt are PIC.

What's going on here? Can I link with libXt and still 
end up with a module which can be dynamically loaded or is this
just impossible?  How come libX11 doesn't cause this problem? 
This is SR10.2 on a DN2500.

nazgul@alphalpha.com (Kee Hinckley) (11/24/90)

In article <1990Nov20.011628.8963@metro.ucc.su.OZ.AU> obrian_n@maths.su.oz.au (Nigel O'Brian) writes:
>file. In fact NONE of the constituent files in libXt are PIC.

Right.  This is a bug, I'd suggest reporting it to Apollo, but
I don't know who would fix it.  The .a files should have all been
built -pic.  Is there any reason you can't use the versions of
those in /lib?  You'll need to add the line -W0,-inlib,/lib/xtlib
(plus one for whatever widget library you are using, unless it's
motif in which case you can just do -inlib,/lib/xmlib1.1 and the
correct xtlib will be pulled in automaticly).

>just impossible?  How come libX11 doesn't cause this problem? 
>This is SR10.2 on a DN2500.
libX11.a isn't needed, it's marked in /etc/sys.conf as being
loaded on demand, so you are getting the shared version, not
the .a file. 


-- 
Alphalpha Software, Inc.	|	motif-request@alphalpha.com
nazgul@alphalpha.com		|-----------------------------------
617/646-7703 (voice/fax)	|	Proline BBS: 617/641-3722

I'm not sure which upsets me more; that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

tomg@hpcvlx.cv.hp.com (Thomas J. Gilg) (11/24/90)

> Problems start if one now wants to include a library in the
> link step. Quick check of the stuff in /usr/lib/X11 shows that
> libX11.a and libXt.a are not PIC. However, linking with libX11
> still gives a PIC file, but linking with libXt gives a non-PIC
> file. In fact NONE of the constituent files in libXt are PIC.

First, to my knowledge all archived libraries in /usr/X11/lib should be
non-PIC for performance reasons.  Second, you should be referencing
/lib/x11lib and /lib/xtlib via  -A inlib,/lib/whatever  in your link
line.

> What's going on here? Can I link with libXt and still 
> end up with a module which can be dynamically loaded or is this
> just impossible?  How come libX11 doesn't cause this problem? 

I've noticed that the "x11lib" entry in /etc/sys.conf results in all types
of mystifying link magic.  You might not be linking against what you
think you are.

Thomas Gilg
tomg@cv.hp.com