|supporting the stripping of Go binaries||Michael Hudson-Doyle||3/13/16 4:48 PM|
Currently it is the case that running 'strip' on Go binaries is not
supported, so there are bits and pieces all over Debian and Ubuntu
that disable the default stripping. But my understanding is that
currently stripping binaries does not cause any actual problems --
it's not not tested in any way by the Go project. What would it take
to "support" stripping? Add some kind of testing to ./all.bash that
stripping the binaries doesn't break things? Some kind of commitment
to look at bug reports about stripping and do something to fix them? I
can put my hand up for this last bit...
(AIUI gccgo is different and stripping gccgo binaries results in them
not working at all and I'm not proposing to change that)
|Re: [golang-dev] supporting the stripping of Go binaries||Dave Cheney||3/13/16 5:00 PM|
Stripping arm binaries has always generated a broken binary.
|Re: [golang-dev] supporting the stripping of Go binaries||Keith Randall||3/13/16 5:11 PM|
I feel like stripping the binaries should work, and if it doesn't that's a bug. Is Go really reading the symbol table from its own binary?
Stripping works fine on a simple amd64 binary.
|Re: [golang-dev] supporting the stripping of Go binaries||Michael Hudson-Doyle||3/13/16 5:12 PM|
|Re: [golang-dev] supporting the stripping of Go binaries||Dave Cheney||3/13/16 5:15 PM|
I honestly don't know, I've not tried it for a few years -- which I
guess is the point of your issue. The first step to supporting
stripping binaries is to add a test to ./all.bash to know what's
|Re: [golang-dev] supporting the stripping of Go binaries||Matthew Dempsky||3/13/16 5:16 PM|
I agree with Keith. From my understanding of ELF and the gc toolchain, there shouldn't be any fundamental reason for stripped binaries to not work. The last time I checked (in response to the Reddit AMA a few weeks ago), I couldn't find any open issues about it not working either.
(gccgo on the other hand does depend on the DWARF debugging info.)
|Re: [golang-dev] supporting the stripping of Go binaries||rsc||3/13/16 6:25 PM|
Works fine for me.
$ cp $(which go) /tmp/zz
$ ls -l /tmp/zz
-rwxr-x--- 1 rsc eng 12598320 Mar 13 21:24 /tmp/zz
$ strip /tmp/zz
$ ls -l /tmp/zz
-rwxr-x--- 1 rsc eng 8637088 Mar 13 21:24 /tmp/zz
Go is a tool for managing Go source code.
go command [arguments]
The commands are:
build compile packages and dependencies
clean remove object files
doc show documentation for package or symbol
env print Go environment information
fix run go tool fix on packages
fmt run gofmt on package sources
generate generate Go files by processing source
get download and install packages and dependencies
install compile and install packages and dependencies
list list packages
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet run go tool vet on packages
Use "go help [command]" for more information about a command.
Additional help topics:
c calling between Go and C
buildmode description of build modes
filetype file types
gopath GOPATH environment variable
environment environment variables
importpath import path syntax
packages description of package lists
testflag description of testing flags
testfunc description of testing functions
Use "go help [topic]" for more information about that topic.
|Re: [golang-dev] supporting the stripping of Go binaries||rsc||3/13/16 6:28 PM|
To answer the original question, I don't think we have to do anything to "support" this, any more than we "support" readelf or objdump or anything else. We don't intentionally do anything that would make stripping a binary not OK, and strip has worked for the past five years or so. What didn't work was using -s with the linker (that is very different from invoking strip), and even that has worked for the past five years or so.
I don't believe a test in all.bash is needed.
|Re: [golang-dev] supporting the stripping of Go binaries||Michael Hudson-Doyle||3/13/16 6:54 PM|
Well, I did this anyway:
https://go-review.googlesource.com/#/c/20584/3. Something very bad
happens on darwin but I don't know what the 'strip' program does there
I guess. Otherwise, all the things that one would expect to work seem
to work. So I think I'll get to work on dispelling this superstition
from our packaging...
|Re: [golang-dev] supporting the stripping of Go binaries||Shahin||3/14/16 7:27 AM|
I strip my arm binaries (http://www.nanodlp.com) since 1.4 without any problem.