Mail Archives: djgpp/2004/08/11/05:01:04
Brian Inglis <Brian DOT Inglis AT SystematicSw DOT Invalid> writes:
> Looks like you're correct about -Cg not being entirely truthful about
> globals without leading _. The revised list of non-Standard globals
> from a dummy program with no #includes compiled with -ansi -pedantic
> are:
>
> T _close close *
> D _edata edata
> B _end end
> B _environ environ
> T _etext etext
> T _sbrk sbrk *
>
> where the routines marked * are Unix compatible routines called by the
> startup/exit code. Can be worked around, as you indicate below?
What version of djgpp are you using? It seems to be older than the
current CVS, because with it you shouldn't see _etext, _edata and _end
unless you actually use them in your code. (close and sbrk are bugs,
but they may be fixed already.)
> Eli Z pointed out that it must be available for POSIX compatible code
> that requires it, but should not be present for ANSI compiles.
> I would be interested in how you can have it defined, if it is
> declared, but not defined as a global, and have it not be defined if
> it is already defined?
The linker can be instructed (by using the PROVIDE construct in the
linker script) to define symbols only if they are referenced but not
defined. That's how _etext, _edata and _end are defined.
--
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/
- Raw text -