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

Side by Side Diff: src/cmd/dist/buildruntime.c

Issue 7891047: code review 7891047: cmd/ld: emit TLS relocations during external linking (Closed)
Patch Set: diff -r 43052d8c5ebf https://code.google.com/p/go Created 11 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/8l/span.c ('k') | src/cmd/ld/data.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include "a.h" 5 #include "a.h"
6 6
7 /* 7 /*
8 * Helpers for building pkg/runtime. 8 * Helpers for building pkg/runtime.
9 */ 9 */
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 "// register and then use -8(%reg) and -4(%reg). This kind\n" 126 "// register and then use -8(%reg) and -4(%reg). This kind\n"
127 "// of addressing is correct even when not running Xen.\n" 127 "// of addressing is correct even when not running Xen.\n"
128 "//\n" 128 "//\n"
129 "// 8l can rewrite MOVL 0(GS), CX into the appropriate pair\n" 129 "// 8l can rewrite MOVL 0(GS), CX into the appropriate pair\n"
130 "// of mov instructions, using CX as the intermediate register\n " 130 "// of mov instructions, using CX as the intermediate register\n "
131 "// (safe because CX is about to be written to anyway).\n" 131 "// (safe because CX is about to be written to anyway).\n"
132 "// But 8l cannot handle other instructions, like storing into 0 (GS),\n" 132 "// But 8l cannot handle other instructions, like storing into 0 (GS),\n"
133 "// which is where these macros come into play.\n" 133 "// which is where these macros come into play.\n"
134 "// get_tls sets up the temporary and then g and r use it.\n" 134 "// get_tls sets up the temporary and then g and r use it.\n"
135 "//\n" 135 "//\n"
136 » » "// The final wrinkle is that get_tls needs to read from %gs:0,\ n" 136 » » "// Another wrinkle is that get_tls needs to read from %gs:0,\n"
137 "// but in 8l input it's called 8(GS), because 8l is going to\n" 137 "// but in 8l input it's called 8(GS), because 8l is going to\n"
138 "// subtract 8 from all the offsets, as described above.\n" 138 "// subtract 8 from all the offsets, as described above.\n"
139 "//\n"
140 "// The final wrinkle is that when generating an ELF .o file for \n"
141 "// external linking mode, we need to be able to relocate the\n"
142 "// -8(r) and -4(r) instructions. Tag them with an extra (GS*1)\ n"
143 "// that is ignored by the linker except for that identification .\n"
139 "#define get_tls(r) MOVL 8(GS), r\n" 144 "#define get_tls(r) MOVL 8(GS), r\n"
140 » » "#define» g(r)» -8(r)\n" 145 » » "#define» g(r)» -8(r)(GS*1)\n"
141 » » "#define» m(r)» -4(r)\n" 146 » » "#define» m(r)» -4(r)(GS*1)\n"
142 }, 147 },
143 {"386", "", 148 {"386", "",
144 "#define get_tls(r)\n" 149 "#define get_tls(r)\n"
145 "#define g(r) 0(GS)\n" 150 "#define g(r) 0(GS)\n"
146 "#define m(r) 4(GS)\n" 151 "#define m(r) 4(GS)\n"
147 }, 152 },
148 ········ 153 ········
149 {"amd64", "windows", 154 {"amd64", "windows",
150 "#define get_tls(r) MOVQ 0x28(GS), r\n" 155 "#define get_tls(r) MOVQ 0x28(GS), r\n"
151 "#define g(r) 0(r)\n" 156 "#define g(r) 0(r)\n"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 378
374 bfree(&in); 379 bfree(&in);
375 bfree(&b); 380 bfree(&b);
376 bfree(&b1); 381 bfree(&b1);
377 bfree(&out); 382 bfree(&out);
378 vfree(&argv); 383 vfree(&argv);
379 vfree(&lines); 384 vfree(&lines);
380 vfree(&fields); 385 vfree(&fields);
381 vfree(&seen); 386 vfree(&seen);
382 } 387 }
OLDNEW
« no previous file with comments | « src/cmd/8l/span.c ('k') | src/cmd/ld/data.c » ('j') | no next file with comments »

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