aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-11-10 22:53:23 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-11-10 22:53:23 +0000
commit980f9a0a4b7a193707ffa5e8ef698a223561b804 (patch)
tree5a870a796677b74bf81d7659534413ed868dad5e /gcc
parent071af74db674f3dc462ab8a25e091b74830fda2d (diff)
downloadgcc-980f9a0a4b7a193707ffa5e8ef698a223561b804.zip
gcc-980f9a0a4b7a193707ffa5e8ef698a223561b804.tar.gz
gcc-980f9a0a4b7a193707ffa5e8ef698a223561b804.tar.bz2
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 From-SVN: r242060
Diffstat (limited to 'gcc')
-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 4004611..c25c2e4 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 d6fa04b..1b0434e 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 a166d1c..acfab18 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 17d46d5..62bbf9e 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 b7411d1..34a7765 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();
}