global vars and symbol visibility for mips32/elf
Jim Wilson
wilson@chestnut.cygnus.com
Sat Aug 10 23:26:00 GMT 1996
The case which causes trouble is when a program uses a common variable
(an uninitialized variable in C; most languages, including C++, have
no notion of common variables).
ANSI/ISO C also does not have common variables. A program with multiple
external definitions of a variable has undefined behaviour. However, C
compilers that make this work by treating uninitialized variables as
common are so prevalent that most people aren't aware of this. This
particular feature is mentioned in the `Common Extensions' appendix, in
the section `Multiple External Definitions'.
This also means that, technically, if you want to make sure that other
ANSI/ISO C compilers can compile your code, you must use -fno-common
in addition to -ansi and -pedantic.
Jim
More information about the Gas2
mailing list