summaryrefslogtreecommitdiff
path: root/src/cmd/dist/buildruntime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/dist/buildruntime.c')
-rw-r--r--src/cmd/dist/buildruntime.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cmd/dist/buildruntime.c b/src/cmd/dist/buildruntime.c
index f46f72d4b..ee867566f 100644
--- a/src/cmd/dist/buildruntime.c
+++ b/src/cmd/dist/buildruntime.c
@@ -133,12 +133,17 @@ static struct {
"// which is where these macros come into play.\n"
"// get_tls sets up the temporary and then g and r use it.\n"
"//\n"
- "// The final wrinkle is that get_tls needs to read from %gs:0,\n"
+ "// Another wrinkle is that get_tls needs to read from %gs:0,\n"
"// but in 8l input it's called 8(GS), because 8l is going to\n"
"// subtract 8 from all the offsets, as described above.\n"
+ "//\n"
+ "// The final wrinkle is that when generating an ELF .o file for\n"
+ "// external linking mode, we need to be able to relocate the\n"
+ "// -8(r) and -4(r) instructions. Tag them with an extra (GS*1)\n"
+ "// that is ignored by the linker except for that identification.\n"
"#define get_tls(r) MOVL 8(GS), r\n"
- "#define g(r) -8(r)\n"
- "#define m(r) -4(r)\n"
+ "#define g(r) -8(r)(GS*1)\n"
+ "#define m(r) -4(r)(GS*1)\n"
},
{"386", "",
"#define get_tls(r)\n"