aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/gogo.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-08-31 03:01:15 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-08-31 03:01:15 +0000
commitc70ff9f9be0c7360a37519ec68ac4dd41e8d0a3c (patch)
tree2a189fbed2324d7708bfe231203bd294028057c9 /gcc/go/gofrontend/gogo.h
parente7c8f75569e792f81a4f4ceee4e1b20f2544e7a4 (diff)
downloadgcc-c70ff9f9be0c7360a37519ec68ac4dd41e8d0a3c.zip
gcc-c70ff9f9be0c7360a37519ec68ac4dd41e8d0a3c.tar.gz
gcc-c70ff9f9be0c7360a37519ec68ac4dd41e8d0a3c.tar.bz2
compiler, runtime: support and use single argument go:linkname
The gc compiler has started permitting go:linkname comments with a single argument to mean that a function should be externally visible outside the package. Implement this in the Go frontend. Change the libgo runtime package to use it, rather than repeating the name just to export a function. Remove a couple of unnecessary go:linkname comments on declarations. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192197 From-SVN: r275239
Diffstat (limited to 'gcc/go/gofrontend/gogo.h')
-rw-r--r--gcc/go/gofrontend/gogo.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 087e890..e742b6e 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -547,7 +547,9 @@ class Gogo
{ this->file_block_names_[name] = location; }
// Add a linkname, from the go:linkname compiler directive. This
- // changes the externally visible name of go_name to be ext_name.
+ // changes the externally visible name of GO_NAME to be EXT_NAME.
+ // If EXT_NAME is the empty string, GO_NAME is unchanged, but the
+ // symbol is made publicly visible.
void
add_linkname(const std::string& go_name, bool is_exported,
const std::string& ext_name, Location location);
@@ -1359,6 +1361,11 @@ class Function
set_asm_name(const std::string& asm_name)
{ this->asm_name_ = asm_name; }
+ // Mark this symbol as exported by a linkname directive.
+ void
+ set_is_exported_by_linkname()
+ { this->is_exported_by_linkname_ = true; }
+
// Return the pragmas for this function.
unsigned int
pragmas() const
@@ -1706,6 +1713,9 @@ class Function
// True if this function is referenced from an inlined body that
// will be put into the export data.
bool is_referenced_by_inline_ : 1;
+ // True if we should make this function visible to other packages
+ // because of a go:linkname directive.
+ bool is_exported_by_linkname_ : 1;
};
// A snapshot of the current binding state.