[gccgo] Make hidden names static

Ian Lance Taylor iant@google.com
Thu Jan 28 07:46:00 GMT 2010


A while ago Go changed to compile all source files in a package at the
same time.  Until that time, all functions and variables had to be
globally visible because you couldn't know which other files in the
package might refer to them.  I also had an option -fdefault-private
to flip that default to make them private.

This patch changes the compiler to remove the -fdefault-private
option, and to make functions and variables static where possible.
That should make for faster linking and for better generated code.  I
also cleaned up type descriptors and conversion tables between types
and interfaces to be defined only in the appropriate package where
possible, rather than using comdat.  Unfortunately, hidden methods
still have to be non-static for now, because they can be picked up by
inheritance.

Since there can now be static functions, I had to make sure that they
are marked TREE_ADDRESSABLE where necessary.  I also had to call
wrapup_global_declarations before cgraph_finalize_compilation_unit,
despite the fact that the default LANG_HOOKS_WRITE_GLOBALS does it the
other way around.

Patch committed to gccgo branch.

Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 22579 bytes
Desc: static
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100128/a1f06a1a/attachment.bin>


More information about the Gcc-patches mailing list