• Russ Cox's avatar
    cmd/ld: external linking fixes for linux/386 · cd94caba
    Russ Cox authored
    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
    cd94caba
elf.c 30.3 KB