diff options
author | Ian Lance Taylor <iant@google.com> | 2012-05-09 21:17:23 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-09 21:17:23 +0000 |
commit | 097b12fb975ba045fffebc2cb1de407d3dba4bbc (patch) | |
tree | 35b68564005a08b6b179869395daba334368b0bc /gcc/go/gccgo.texi | |
parent | 1b8b126f386ffff12b02f7c9cb2a00c38996f1ea (diff) | |
download | gcc-097b12fb975ba045fffebc2cb1de407d3dba4bbc.zip gcc-097b12fb975ba045fffebc2cb1de407d3dba4bbc.tar.gz gcc-097b12fb975ba045fffebc2cb1de407d3dba4bbc.tar.bz2 |
compiler: Add -fgo-pkgpath option.
* lang.opt: Add -fgo-pkgpath.
* go-lang.c (go_pkgpath): New static variable.
(go_prefix): New static variable.
(go_langhook_init): Pass go_pkgpath and go_prefix to
go_create_gogo.
(go_langhook_handle_option): Handle -fgo-pkgpath. Change
-fgo-prefix handling to just set go_prefix.
* go-c.h (go_set_prefix): Don't declare.
(go_create_gogo): Add pkgpath and prefix to declaration.
* go-gcc.cc (Gcc_backend::global_variable): Change unique_prefix
to pkgpath. Don't include the package name in the asm name.
* gccgo.texi (Invoking gccgo): Document -fgo-pkgpath. Update the
docs for -fgo-prefix.
From-SVN: r187356
Diffstat (limited to 'gcc/go/gccgo.texi')
-rw-r--r-- | gcc/go/gccgo.texi | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/gcc/go/gccgo.texi b/gcc/go/gccgo.texi index 5d0efb4..a5e37e7 100644 --- a/gcc/go/gccgo.texi +++ b/gcc/go/gccgo.texi @@ -157,14 +157,32 @@ compile time. When linking, specify a library search directory, as with @command{gcc}. +@item -fgo-pkgpath=@var{string} +@cindex @option{-fgo-pkgpath} +Set the package path to use. This sets the value returned by the +PkgPath method of reflect.Type objects. It is also used for the names +of globally visible symbols. The argument to this option should +normally be the string that will be used to import this package after +it has been installed; in other words, a pathname within the +directories specified by the @option{-I} option. + @item -fgo-prefix=@var{string} @cindex @option{-fgo-prefix} +An alternative to @option{-fgo-pkgpath}. The argument will be +combined with the package name from the source file to produce the +package path. If @option{-fgo-pkgpath} is used, @option{-fgo-prefix} +will be ignored. + Go permits a single program to include more than one package with the -same name. This option is required to make this work with -@command{gccgo}. The argument to this option may be any string. Each -package with the same name must use a distinct @option{-fgo-prefix} -option. The argument is typically the full path under which the -package will be installed, as that must obviously be unique. +same name in the @code{package} clause in the source file, though +obviously the two packages must be imported using different pathnames. +In order for this to work with @command{gccgo}, either +@option{-fgo-pkgpath} or @option{-fgo-prefix} must be specified when +compiling a package. + +Using either @option{-fgo-pkgpath} or @option{-fgo-prefix} disables +the special treatment of the @code{main} package and permits that +package to be imported like any other. @item -frequire-return-statement @itemx -fno-require-return-statement |