aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/go.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2012-05-09 21:17:23 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-05-09 21:17:23 +0000
commit097b12fb975ba045fffebc2cb1de407d3dba4bbc (patch)
tree35b68564005a08b6b179869395daba334368b0bc /gcc/go/gofrontend/go.cc
parent1b8b126f386ffff12b02f7c9cb2a00c38996f1ea (diff)
downloadgcc-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/gofrontend/go.cc')
-rw-r--r--gcc/go/gofrontend/go.cc35
1 files changed, 7 insertions, 28 deletions
diff --git a/gcc/go/gofrontend/go.cc b/gcc/go/gofrontend/go.cc
index bfa3afd..1f2ce8a 100644
--- a/gcc/go/gofrontend/go.cc
+++ b/gcc/go/gofrontend/go.cc
@@ -13,11 +13,6 @@
#include "backend.h"
#include "gogo.h"
-// The unique prefix to use for exported symbols. This is set during
-// option processing.
-
-static std::string unique_prefix;
-
// The data structures we build to represent the file.
static Gogo* gogo;
@@ -25,38 +20,22 @@ static Gogo* gogo;
GO_EXTERN_C
void
-go_create_gogo(int int_type_size, int pointer_size)
+go_create_gogo(int int_type_size, int pointer_size, const char *pkgpath,
+ const char *prefix)
{
go_assert(::gogo == NULL);
Linemap* linemap = go_get_linemap();
::gogo = new Gogo(go_get_backend(), linemap, int_type_size, pointer_size);
- if (!unique_prefix.empty())
- ::gogo->set_unique_prefix(unique_prefix);
+
+ if (pkgpath != NULL)
+ ::gogo->set_pkgpath(pkgpath);
+ else if (prefix != NULL)
+ ::gogo->set_prefix(prefix);
// FIXME: This should be in the gcc dependent code.
::gogo->define_builtin_function_trees();
}
-// Set the unique prefix we use for exported symbols.
-
-GO_EXTERN_C
-void
-go_set_prefix(const char* arg)
-{
- unique_prefix = arg;
- for (size_t i = 0; i < unique_prefix.length(); ++i)
- {
- char c = unique_prefix[i];
- if ((c >= 'a' && c <= 'z')
- || (c >= 'A' && c <= 'Z')
- || (c >= '0' && c <= '9')
- || c == '_')
- ;
- else
- unique_prefix[i] = '_';
- }
-}
-
// Parse the input files.
GO_EXTERN_C