Description5l,6l: Implement -shared in terms of external linking (linux/adm64+linux/arm)
The -shared flag to 6l outputs a shared library, implemented in Go
and callable from non-Go programs such as C.
The main part of this CL change the thread local storage model.
Go uses the fastest and least general mode, local exec. TLS data in shared
libraries normally requires at least the local dynamic mode, however, this CL
instead opts for using the initial exec mode. Initial exec mode is faster than
local dynamic mode and can be used in linux since the linker has reserved a
limited amount of TLS space for performance sensitive TLS code.
Initial exec mode requires an extra load from the GOT table to determine the
TLS offset. This penalty will not be paid if ld is not in -shared mode, since
TLS accesses will be reduced to local exec.
The elf sections .init_array and .rela.init_array are added to register the Go
runtime entry with cgo at library load time.
The "hidden" attribute is added to Cgo functions called from Go, since Go
does not generate call through the GOT table, and adding non-GOT relocations for
a global function is not supported by gcc. Cgo symbols don't need to be global
and avoiding the GOT table is also faster.
The changes to 8l are only removes code relevant to the old -shared mode where internal linking was used.
This CL only address the low level linker work. It can be submitted by itself, but to be useful, the runtime changes in CL 9738047 is also needed.
Design discussion at https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/zmjXkGrEx6Q
Patch Set 1 #Patch Set 2 : diff -r 3f530b76de99 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 3f530b76de99 https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 1c764773c6ce https://go.googlecode.com/hg/ #Patch Set 5 : diff -r 1c764773c6ce https://go.googlecode.com/hg/ #Patch Set 6 : diff -r f70198907de7 https://go.googlecode.com/hg/ #Patch Set 7 : diff -r a973041f88493909b154b3a1a88b5d52edeb6c83 https://go.googlecode.com/hg/ #Patch Set 8 : diff -r f95d6c811a5b6a5eed6f6aa3536d609c6ae9f233 https://go.googlecode.com/hg/ #Patch Set 9 : diff -r 342004b8cef2042b4e01662dcdad337538b0e92b https://go.googlecode.com/hg/ #Patch Set 10 : diff -r 342004b8cef2042b4e01662dcdad337538b0e92b https://go.googlecode.com/hg/ #
Total comments: 4
Patch Set 11 : diff -r 2b995a29ade5fd16f1ff0d3b0000f9efa8dc4eb7 https://go.googlecode.com/hg/ #
MessagesTotal messages: 7
|