]> Cypherpunks repositories - gostls13.git/commit
cmd/ld: external linking fixes for linux/386
authorRuss Cox <rsc@golang.org>
Sat, 9 Mar 2013 04:22:38 +0000 (20:22 -0800)
committerRuss Cox <rsc@golang.org>
Sat, 9 Mar 2013 04:22:38 +0000 (20:22 -0800)
commitcd94cabad6091af76c2d4950f11442bdb40b7b46
tree74264dd74a9ccaf8b5598c82aaec7a281d1afb02
parent0406c63ea38520adf040f3f72ea3d8008dd53480
cmd/ld: external linking fixes for linux/386

The sticking point on 386 has been the "PC relative" relocations
used to point the garbage collection metadata at the type info.
These aren't in the code segment, and I don't trust that the linker
isn't doing something special that would be okay in code but
not when interpreting the pointers as data (for example, a PLT
jump table would be terrible).

Solve the problem in two steps:

1. Handle "PC relative" relocations within a section internally,
so that the external linker never sees them.

2. Move the gcdata and gcbss tables into the rodata section,
where the type information lives, so that the relocations can
be handled internally.

(To answer the obvious question, we make the gc->type
references relative so that they need not be relocated
individually when generating a shared object file.)

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7629043
src/cmd/ld/data.c
src/cmd/ld/elf.c
src/cmd/ld/lib.c
src/cmd/ld/lib.h
src/cmd/ld/symtab.c