supporting the stripping of Go binaries

Showing 1-10 of 10 messages
supporting the stripping of Go binaries Michael Hudson-Doyle 3/13/16 4:48 PM
Hi,

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...

Cheers,
mwh

(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.


--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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
Still? I thought that got fixed in 2010:
https://codereview.appspot.com/994044 and a stripped hello world works
for me (in a armhf chroot on an arm64 system but I doubt that
matters).

Cheers,
mwh
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
missing today.
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.)


--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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
$ /tmp/zz
Go is a tool for managing Go source code.

Usage:

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.

Russ

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...

Cheers,
mwh
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.


On Monday, March 14, 2016 at 3:30:25 AM UTC+3:30, Dave Cheney wrote:

Stripping arm binaries has always generated a broken binary.


On Mon, 14 Mar 2016, 10:48 Michael Hudson-Doyle, <michael...@canonical.com> wrote:
Hi,

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...

Cheers,
mwh

(AIUI gccgo is different and stripping gccgo binaries results in them
not working at all and I'm not proposing to change that)

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.