]> Cypherpunks repositories - gostls13.git/commit
ld: fix ELF strip by removing overlap of sections
authorGustavo Niemeyer <gustavo@niemeyer.net>
Tue, 28 Jun 2011 21:28:30 +0000 (22:28 +0100)
committerGustavo Niemeyer <gustavo@niemeyer.net>
Tue, 28 Jun 2011 21:28:30 +0000 (22:28 +0100)
commitcf143e9dbf6e3c5b0b2a97c76980b6d5bd5cc40f
treea8472d59b38c48c0601d1617fbe97227c1234b91
parentd0ac84fe404d345e25571ab0ee7596fc358d8b84
ld: fix ELF strip by removing overlap of sections

The gosymtab and gopclntab sections were pointing to the proper
data, but that data was already owned by the rodata section.
Some ELF references explicitly prohibit multiple sections from
owning the same data, and strip behaves accordingly.

The data for these sections was moved to after rodata, and the
gosymtab and gopclntab sections now own their respective ranges.

This change makes strip happy both with and without -s being
provided at link time.  Note that it won't remove these sections
because they are still allocated, and that's by design since
they are necessary at runtime for generating proper backtraces
and similar introspection operations.

Unlike the previous behavior, -s will now maintain zero-sized
gosymtab and gopclntab sections.  This makes the implementation
slightly cleaner.

Fixes #1242.

NOTE: Tested on Linux amd64/386/arm only.

R=ality, rsc
CC=golang-dev
https://golang.org/cl/4639077
src/cmd/5l/asm.c
src/cmd/6l/asm.c
src/cmd/8l/asm.c
src/cmd/ld/data.c
src/cmd/ld/lib.c
src/cmd/ld/lib.h
src/cmd/ld/symtab.c