Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(434)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 7975045: code review 7975045: cmd/ld: emit TLS relocations during external linking

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 9 months ago by rsc
Modified:
12 years ago
Reviewers:
gobot, iant
CC:
golang-dev
Visibility:
Public.
cmd/ld: emit TLS relocations during external linking This CL adds TLS relocation to the ELF .o file we write during external linking, so that the host linker (gcc) can decide the final location of m and g. Similar relocations are not necessary on OS X because we use an alternate program start-time mechanism to acquire thread-local storage. Similar relocations are not necessary on ARM or Plan 9 or Windows because external linking mode is not yet supported on those systems. On almost all ELF systems, the references we use are like %fs:-0x4 or %gs:-0x4, which we write in 6a/8a as -0x4(FS) or -0x4(GS). On Linux/ELF, however, Xen's lack of support for this mode forced us long ago to use a two-instruction sequence: first we load %gs:0x0 into a register r, and then we use -0x4(r). (The ELF program loader arranges that %gs:0x0 contains a regular pointer to that same memory location.) In order to relocate those -0x4(r) references, the linker must know where they are. This CL adds the equivalent notation -0x4(r)(GS*1) for this purpose: it assembles to the same encoding as -0x4(r) but the (GS*1) indicates to the linker that this is one of those thread-local references that needs relocation. Thanks to Elias Naur for reminding me about this missing piece and also for writing the test.

Patch Set 1 #

Patch Set 2 : diff -r b3cfb8be2faf https://code.google.com/p/go/ #

Patch Set 3 : diff -r bcc0898b0026 https://code.google.com/p/go/ #

Total comments: 1
Created: 12 years, 9 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+771 lines, -835 lines) Patch
A misc/cgo/testtls/tls.go View 1 1 chunk +28 lines, -0 lines 0 comments Download
A misc/cgo/testtls/tls_test.go View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
A misc/cgo/testtls/tls_unix.c View 1 1 chunk +19 lines, -0 lines 0 comments Download
M src/cmd/5l/5.out.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/6l/6.out.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/6l/asm.c View 1 1 chunk +7 lines, -0 lines 0 comments Download
M src/cmd/6l/obj.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/6l/span.c View 1 2 chunks +23 lines, -0 lines 0 comments Download
M src/cmd/8a/a.y View 1 1 chunk +9 lines, -0 lines 0 comments Download
M src/cmd/8a/y.tab.h View 1 4 chunks +21 lines, -25 lines 0 comments Download
M src/cmd/8a/y.tab.c View 1 117 chunks +535 lines, -795 lines 0 comments Download
M src/cmd/8l/8.out.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/8l/asm.c View 1 1 chunk +6 lines, -0 lines 0 comments Download
M src/cmd/8l/obj.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/8l/pass.c View 1 2 chunks +4 lines, -0 lines 1 comment Download
M src/cmd/8l/span.c View 1 5 chunks +33 lines, -2 lines 0 comments Download
M src/cmd/dist/buildruntime.c View 1 1 chunk +8 lines, -3 lines 0 comments Download
M src/cmd/ld/data.c View 1 4 chunks +25 lines, -6 lines 0 comments Download
M src/cmd/ld/elf.c View 1 3 chunks +7 lines, -1 line 0 comments Download
M src/cmd/ld/lib.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/ld/symtab.c View 1 1 chunk +20 lines, -0 lines 0 comments Download
M src/run.bash View 1 2 1 chunk +7 lines, -1 line 0 comments Download
Total messages: 3
|
rsc
Hello iant (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
12 years, 9 months ago (2013年03月25日 21:50:48 UTC) #1
Hello iant (cc: golang-dev@googlegroups.com),
I'd like you to review this change to
https://code.google.com/p/go/ 
Sign in to reply to this message.
iant
https://codereview.appspot.com/7975045/diff/4001/src/cmd/8l/pass.c File src/cmd/8l/pass.c (right): https://codereview.appspot.com/7975045/diff/4001/src/cmd/8l/pass.c#newcode304 src/cmd/8l/pass.c:304: q->from.index = D_GS; // signal to relocate I don't ...
12 years, 9 months ago (2013年03月27日 20:19:09 UTC) #2
https://codereview.appspot.com/7975045/diff/4001/src/cmd/8l/pass.c
File src/cmd/8l/pass.c (right):
https://codereview.appspot.com/7975045/diff/4001/src/cmd/8l/pass.c#newcode304
src/cmd/8l/pass.c:304: q->from.index = D_GS; // signal to relocate
I don't think this is right when linkmode == LinkExternal. In that case I think
we should generate the relocation on the movl and let the system linker sort it
out. If we do this, we wind up using a TLS reloc to indirect into the TCB,
which pretty much works, but only by accident, and is not what the reloc is
intended to do.
I will incorporate this CL into 7891047 and submit that instead.
Sign in to reply to this message.
gobot
R=close (assigned by rsc@google.com)
12 years ago (2013年12月18日 16:54:41 UTC) #3
R=close (assigned by rsc@google.com)
Sign in to reply to this message.
|
Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /