aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-08-02 17:01:43 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-08-02 17:01:43 +0000
commitaa7e089fdc0e8095f6790ec53ccad0472573de79 (patch)
treee0c11ccced33f5f345ee2f6e9470a50fdbd04268 /gcc/go/gofrontend
parentd62d51524697e5a8422c6ca31977b7ad5a2628c1 (diff)
downloadgcc-aa7e089fdc0e8095f6790ec53ccad0472573de79.zip
gcc-aa7e089fdc0e8095f6790ec53ccad0472573de79.tar.gz
gcc-aa7e089fdc0e8095f6790ec53ccad0472573de79.tar.bz2
compiler: Always put descriptor wrappers in their own section.
This lets the linker GC them. From-SVN: r201442
Diffstat (limited to 'gcc/go/gofrontend')
-rw-r--r--gcc/go/gofrontend/gogo.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 6ae72b6..0b69d5d 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -3582,6 +3582,12 @@ Function::make_descriptor_wrapper(Gogo* gogo, Named_object* no,
Named_object* dno = gogo->start_function(name, new_fntype, false, loc);
dno->func_value()->is_descriptor_wrapper_ = true;
+ // Put the wrapper in a unique section so that it can be discarded
+ // by the linker if it is not needed. Every top-level function will
+ // get a wrapper, in case there is a reference other than a call
+ // from some other package, but most will not need one.
+ dno->func_value()->set_in_unique_section();
+
gogo->start_block(loc);
Expression* fn = Expression::make_func_reference(no, NULL, loc);