[gofrontend-dev] Re: [PATCH 00/13] Go closures, libffi, and the static chain

Richard Henderson rth@redhat.com
Fri Dec 12 18:49:00 GMT 2014


On 12/12/2014 05:57 AM, Dominik Vogt wrote:
> On Thu, Dec 11, 2014 at 07:51:44PM +1030, Alan Modra wrote:
>> I was worried about exactly the same "problem" on powerpc with r11
>> being used for the static chain and also destroyed in linkage stubs.
>> It turns out we don't traverse any linkage stubs.
>>
>> See https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00446.html.  
> 
> I've written a small test suite that tests reflection calls over
> module boundaries (see attachment).  Build with "make" and then
> just run "./main".  The program must not crash; it does not check
> consistency of the function arguments.

Oh, that's interesting.  You've found a bug in the x86_64 linking:

gccgo -g3 -O3 -Wall -Werror -c -fPIC q.go -o q.o
gccgo -shared -Wl,-soname,libq.so -o libq.so q.o
gccgo -g3 -O3 -Wall -Werror -c -fPIC p.go -o p.o
gccgo -shared -Wl,-soname,libp.so -o libp.so p.o
gccgo -g3 -O3 -Wall -Werror -o main main.go libq.so libp.so
/usr/bin/ld: main: hidden symbol `__morestack' in
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/libgcc.a(morestack.o) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [main] Error 1

Sure enough, both shared libraries failed to pull __morestack
from the static libgcc.

$ nm libq.so | grep more
                 U __morestack

I guess __morestack is included in the wrong portion of libgcc?

Ian?


r~



More information about the Gcc-patches mailing list