summaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-11-10 22:53:23 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-11-10 22:53:23 +0000
commit87211034d071d80dceb8b74fd78edbd2815c6a18 (patch)
tree5a870a796677b74bf81d7659534413ed868dad5e /gcc/go
parentd30c4aee920b03bc7732135656966f8bbf703783 (diff)
downloadgcc-87211034d071d80dceb8b74fd78edbd2815c6a18.tar.gz
runtime: copy signal code from Go 1.7 runtime
Add a little shell script to auto-generate runtime.sigtable from the known signal names. Force the main package to always import the runtime package. Otherwise some runtime package global variables may never be initialized. Set the syscallsp and syscallpc fields of g when entering a syscall, so that the runtime package knows when a g is executing a syscall. Fix runtime.funcPC to avoid dead store elimination of the interface value when the function is inlined. Reviewed-on: https://go-review.googlesource.com/33025 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242060 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc2
-rw-r--r--gcc/go/gofrontend/gogo.cc12
-rw-r--r--gcc/go/gofrontend/gogo.h2
-rw-r--r--gcc/go/gofrontend/parse.cc2
5 files changed, 15 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 40046113d3f..c25c2e48642 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-cac897bd27885c18a16dacfe27d5efd4526455c5
+449e918b0f93d3e3339edcec21a5bc157f548e54
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index d6fa04b6215..1b0434ed098 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -3791,7 +3791,7 @@ Unary_expression::do_flatten(Gogo* gogo, Named_object*,
this->escapes_ = false;
// When compiling the runtime, the address operator does not
- // cause local variables to escapes. When escape analysis
+ // cause local variables to escape. When escape analysis
// becomes the default, this should be changed to make it an
// error if we have an address operator that escapes.
if (gogo->compiling_runtime() && gogo->package_name() == "runtime")
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index a166d1c5c4e..acfab188a80 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -394,6 +394,7 @@ void
Gogo::import_package(const std::string& filename,
const std::string& local_name,
bool is_local_name_exported,
+ bool must_exist,
Location location)
{
if (filename.empty())
@@ -497,7 +498,8 @@ Gogo::import_package(const std::string& filename,
this->relative_import_path_);
if (stream == NULL)
{
- go_error_at(location, "import file %qs not found", filename.c_str());
+ if (must_exist)
+ go_error_at(location, "import file %qs not found", filename.c_str());
return;
}
@@ -2179,6 +2181,14 @@ Gogo::is_thunk(const Named_object* no)
void
Gogo::define_global_names()
{
+ if (this->is_main_package())
+ {
+ // Every Go program has to import the runtime package, so that
+ // it is properly initialized.
+ this->import_package("runtime", "_", false, false,
+ Linemap::predeclared_location());
+ }
+
for (Bindings::const_declarations_iterator p =
this->globals_->begin_declarations();
p != this->globals_->end_declarations();
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 17d46d503fd..62bbf9e11ae 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -301,7 +301,7 @@ class Gogo
// the declarations are added to the global scope.
void
import_package(const std::string& filename, const std::string& local_name,
- bool is_local_name_exported, Location);
+ bool is_local_name_exported, bool must_exist, Location);
// Whether we are the global binding level.
bool
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index b7411d14ffa..34a7765418d 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -5722,7 +5722,7 @@ Parse::import_spec(void*)
}
this->gogo_->import_package(token->string_value(), local_name,
- is_local_name_exported, location);
+ is_local_name_exported, true, location);
this->advance_token();
}