__DYNAMIC

symult!david at csvax.caltech.edu symult!david at csvax.caltech.edu
Sat Jun 24 07:19:32 AEST 1989


SUN OS version: 4.0.3 on a Sun 3/60 (same behavior for 4.0.x OS)

I would like to create an intermediate executable file using the -r switch
of the linker. I am using the -Bstatic switch. When I do so, I get a
diagnostic stating that __DYNAMIC is undefined. Does anyone know how to
shut this message up? (It's a bug in ld since -r implies that all
undefined error messages are suppressed). If I try to define __DYNAMIC
myself, ld complains that I am trying to define a loader-defined symbol.
The executable created is fine.

Sample session (for any C file called t.c):

% cc -Bstatic -c t.c
% cc -Bstatic -r -o t.out t.o
Undefined:
__DYNAMIC
% ld -o t.new t.out

If you declare 
static int _DYNAMIC = 0;
in t.c, the linker will complain (as it should):

% cc -Bstatic -c t.c
% cc -Bstatic -r -o t.out t.o
% ld -o t.new t.out
__DYNAMIC: ld: user attempt to redefine loader-defined symbol
__DYNAMIC: t.out: multiply defined



More information about the Comp.sys.sun mailing list