• Russ Cox's avatar
    cmd/ld: use native-endian symbol values in symbol table · 4e2aa9bf
    Russ Cox authored
    The Plan 9 symbol table format defines big-endian symbol values
    for portability, but we want to be able to generate an ELF object file
    and let the host linker link it, as part of the solution to issue 4069.
    The symbol table itself, since it is loaded into memory at run time,
    must be filled in by the final host linker, using relocation directives
    to set the symbol values. On a little-endian machine, the linker will
    only fill in little-endian values during relocation, so we are forced
    to use little-endian symbol values.
    
    To preserve most of the original portability of the symbol table
    format, we make the table itself say whether it uses big- or
    little-endian values. If the table begins with the magic sequence
            fe ff ff ff 00 00
    then the actual table begins after those six bytes and contains
    little-endian symbol values. Otherwise, the table is in the original
    format and contains big-endian symbol values. The magic sequence
    looks like an "end of table" entry (the fifth byte is zero), so legacy
    readers will see a little-endian table as an empty table.
    
    All the gc architectures are little-endian today, so the practical
    effect of this CL is to make all the generated tables little-endian,
    but if a big-endian system comes along, ld will not generate
    the magic sequence, and the various readers will fall back to the
    original big-endian interpretation.
    
    R=ken2
    CC=golang-dev
    https://golang.org/cl/7066043
    4e2aa9bf
Name
Last commit
Last update
..
5.c Loading commit data...
5db.c Loading commit data...
5obj.c Loading commit data...
6.c Loading commit data...
6obj.c Loading commit data...
8.c Loading commit data...
8db.c Loading commit data...
8obj.c Loading commit data...
Makefile Loading commit data...
access.c Loading commit data...
darwin.c Loading commit data...
elf.h Loading commit data...
executable.c Loading commit data...
fakeobj.c Loading commit data...
freebsd.c Loading commit data...
linux.c Loading commit data...
machdata.c Loading commit data...
macho.h Loading commit data...
map.c Loading commit data...
netbsd.c Loading commit data...
obj.c Loading commit data...
obj.h Loading commit data...
openbsd.c Loading commit data...
plan9.c Loading commit data...
setmach.c Loading commit data...
swap.c Loading commit data...
sym.c Loading commit data...
windows.c Loading commit data...