Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(271)

Issue 9733044: code review 9733044: 6l: Implement -shared in terms of external linking (lin... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 10 months ago by elias.naur
Modified:
10 years, 7 months ago
Reviewers:
rsc, golang-dev
Visibility:
Public.

Description

5l,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/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+407 lines, -291 lines) Patch
M src/cmd/5l/asm.c View 1 2 3 4 5 6 7 8 9 10 3 chunks +8 lines, -9 lines 0 comments Download
M src/cmd/5l/l.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +0 lines, -2 lines 0 comments Download
M src/cmd/5l/noop.c View 1 2 3 4 5 6 7 8 9 10 2 chunks +30 lines, -2 lines 0 comments Download
M src/cmd/5l/obj.c View 1 2 3 4 5 6 2 chunks +4 lines, -2 lines 0 comments Download
M src/cmd/5l/pass.c View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M src/cmd/5l/span.c View 1 2 3 4 5 6 1 chunk +1 line, -4 lines 0 comments Download
M src/cmd/6a/a.y View 1 2 3 4 5 6 7 8 9 10 1 chunk +9 lines, -0 lines 0 comments Download
M src/cmd/6a/y.tab.c View 1 2 3 4 5 6 7 8 9 10 18 chunks +179 lines, -164 lines 0 comments Download
M src/cmd/6l/asm.c View 1 2 chunks +6 lines, -9 lines 0 comments Download
M src/cmd/6l/l.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +0 lines, -2 lines 0 comments Download
M src/cmd/6l/obj.c View 1 4 chunks +5 lines, -3 lines 0 comments Download
M src/cmd/6l/pass.c View 1 2 3 4 5 6 7 8 9 10 6 chunks +81 lines, -1 line 0 comments Download
M src/cmd/6l/span.c View 1 2 3 4 5 6 3 chunks +22 lines, -5 lines 0 comments Download
M src/cmd/8l/asm.c View 1 1 chunk +0 lines, -6 lines 0 comments Download
M src/cmd/8l/l.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +0 lines, -2 lines 0 comments Download
M src/cmd/8l/obj.c View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/cmd/cgo/out.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/dist/buildruntime.c View 1 2 3 4 5 6 1 chunk +7 lines, -3 lines 0 comments Download
M src/cmd/ld/data.c View 1 2 3 4 5 6 7 8 9 10 10 chunks +8 lines, -39 lines 0 comments Download
M src/cmd/ld/elf.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/ld/elf.c View 1 2 3 4 5 6 7 8 9 10 4 chunks +9 lines, -12 lines 0 comments Download
M src/cmd/ld/go.c View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -2 lines 0 comments Download
M src/cmd/ld/lib.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +1 line, -2 lines 0 comments Download
M src/cmd/ld/lib.c View 1 2 3 4 5 6 7 8 9 10 5 chunks +25 lines, -16 lines 0 comments Download
M src/cmd/ld/symtab.c View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 7
elias.naur
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
10 years, 10 months ago (2013-05-29 20:19:08 UTC) #1
rsc
Thanks for working on this. I have the same reservations about this code as I ...
10 years, 10 months ago (2013-06-03 20:20:02 UTC) #2
elias.naur
Added linux/arm support and updated to apply to tip.
10 years, 9 months ago (2013-06-24 15:23:05 UTC) #3
rsc
https://codereview.appspot.com/9733044/diff/29027/src/cmd/5l/span.c File src/cmd/5l/span.c (right): https://codereview.appspot.com/9733044/diff/29027/src/cmd/5l/span.c#newcode580 src/cmd/5l/span.c:580: return C_LCONADDR; Before there was a -shared flag, this ...
10 years, 8 months ago (2013-07-29 17:38:08 UTC) #4
elias.naur
Thanks for reviewing this. On 2013/07/29 17:38:08, rsc wrote: > https://codereview.appspot.com/9733044/diff/29027/src/cmd/5l/span.c > File src/cmd/5l/span.c (right): ...
10 years, 8 months ago (2013-07-29 19:34:34 UTC) #5
rsc
LGTM I think the new assembly syntax is bizarre, but apparently I came up with ...
10 years, 7 months ago (2013-08-13 19:20:05 UTC) #6
elias.naur
10 years, 7 months ago (2013-08-13 22:12:49 UTC) #7
On 2013/08/13 19:20:05, rsc wrote:
> LGTM
> 
> I think the new assembly syntax is bizarre, but apparently I came up with it
for
> 8a, so I won't hold it against you.

Thanks :) I'll update this CL when the two other CLs are in.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b