1
0
mirror of https://github.com/golang/go synced 2024-10-07 07:41:21 -06:00
go/src/libmach
Russ Cox 4e2aa9bff0 cmd/ld: use native-endian symbol values in symbol table
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
2013-01-04 17:03:57 -05:00
..
5.c build: fixes for mingw-w64 2011-07-25 13:39:01 -04:00
5db.c libmach: fix for Plan 9 build 2011-11-18 23:11:50 -05:00
5obj.c cmd/5a, cmd/5l: add MULW{T,B} and MULAW{T,B} support for ARM 2012-06-08 02:42:28 +08:00
6.c
6obj.c
8.c
8db.c cmd/6l: loop alignment, disabled 2012-06-01 10:23:15 -04:00
8obj.c fix build after Mercurial move. 2009-10-22 10:59:27 -07:00
access.c
darwin.c runtime/cgo: check for errors from pthread_create 2011-06-28 12:04:50 -04:00
elf.h
executable.c libmach, cmd/cc, cmd/cov, cmd/ld, cmd/prof: check malloc return value 2012-11-27 03:05:46 +08:00
fakeobj.c build: fix unused parameters 2011-08-25 16:08:13 -04:00
freebsd.c libmach: fix freebsd compiler errors 2011-04-13 16:26:25 -04:00
linux.c build: fix unused parameters 2011-08-25 16:08:13 -04:00
machdata.c libmach: fix for Plan 9 build 2011-11-18 23:11:50 -05:00
macho.h
Makefile build: delete make paraphernalia 2012-02-06 13:34:25 -05:00
map.c build: fix unused parameters 2011-08-25 16:08:13 -04:00
netbsd.c os: OS-dependent bits to support NetBSD. 2011-12-15 12:19:19 -05:00
obj.c libmach, cmd/cc, cmd/cov, cmd/ld, cmd/prof: check malloc return value 2012-11-27 03:05:46 +08:00
obj.h
openbsd.c libmach: stubs for openbsd 2011-07-29 13:48:00 -04:00
plan9.c libmach: add stubs for Plan 9 2012-01-31 18:13:17 -08:00
setmach.c support for 5.out files 2009-10-19 22:33:56 -07:00
swap.c
sym.c cmd/ld: use native-endian symbol values in symbol table 2013-01-04 17:03:57 -05:00
windows.c libmach: fix the windows build. 2011-04-13 14:57:47 -07:00