Re: XForms: Nasty pointer bug.

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 28 May 98 18:44:32 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I realize that and I'm pretty much aware of how to generate a static
> executable under FreeBSD (``-static'' for gcc -Bstatic for ld). ...

Sorry -- from your original question I couldn't tell how experienced
you were.

> ... I get one
> of two errors trying to create the static version of the program:
> ld either complains about __DYNAMIC or it complains about
> _GLOBAL_OFFSET_TABLE_ The __DYNAMIC is possible a FreeBSD issue which I
> can find out about by looking at the source code for any staticly linked
> executable in /bin. The _GLOBAL_OFFSET_TABLE_ seems to be a Forms thing.

It's a gcc-ism. This is something caused by the -fpic or (I think)
the -fPIC options. From the GCC info file:

`-fpic' Generate position-independent code (PIC) suitable for use in a
shared library, if supported for the target machine. Such code
accesses all constant addresses through a global offset table
(GOT). The dynamic loader resolves the GOT entries when the
program starts (the dynamic loader is not part of GNU CC; it is
part of the operating system). If the GOT size for the linked
executable exceeds a machine-specific maximum size, you get an
error message from the linker indicating that `-fpic' does not
work; in that case, recompile with `-fPIC' instead. (These
maximums are 16k on the m88k, 8k on the Sparc, and 32k on the
m68k and RS/6000. The 386 has no such limit.)

Position-independent code requires special support, and therefore
works only on certain machines. For the 386, GNU CC supports PIC
for System V but not for the Sun 386i. Code generated for the
IBM RS/6000 is always position-independent.

`-fPIC'
If supported for the target machine, emit position-independent
code, suitable for dynamic linking and avoiding any limit on the
size of the global offset table. This option makes a difference
on the m68k, m88k, and the Sparc.

Position-independent code requires special support, and therefore
works only on certain machines.

I am able to link statically on both Sun and SGI platforms just by
using the -Xlinker directive and the appropriate ld directives. On
the SGI it's

-Xlinker -B -Xlinker static

to make the link static and

-Xlinker -B -Xlinker dynamic

to return to dynamic linking.

On the Sun it's

-Xlinker -Bstatic

and

-Xlinker -Bdynamic

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/