"const" globals are being handled as "static const" globals?

Brad M. Garcia bgarcia@fore.com
Thu May 14 10:50:00 GMT 1998


If you define a variable within a file (global) like:

   const int foo = 1;

and compile it, you will find that egcs does _not_ give it global scope:

   > nm a.o
   00000000 r foo

That is, it is treating "foo" as a "static const" instead of just "const".
Removing the const gives the correct behavior:

   > nm a.o
   00000000 D foo

But then it isn't placed into a read-only section.

Brad Garcia
   ___/  __ /  __ /  ___/ "Being the Linux of digital media
  __/   /  /  / _/  __/    would be a very good life."
_/    ____/ _/ _| ____/      - Jean-Louis Gassee, CEO of Be, Inc.




More information about the Gcc-bugs mailing list