gccgo binaries cannot be stripped

Bug #1318027 reported by Steve Langasek
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gccgo-6 (Ubuntu)
Fix Released
Undecided
Unassigned
golang (Debian)
Fix Released
Unknown
golang (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binaries built with gccgo-4.9 in utopic cannot be stripped at all. Doing so causes the binaries to be un-runnable due to lack of debugging symbols:

$ ./debian/nuntium/usr/bin/nuntium
2014/05/09 19:10:41 Connection error: Unknown address type
$ DH_VERBOSE=1 dh_strip -a
 strip --remove-section=.comment --remove-section=.note debian/nuntium/usr/bin/nuntium
 strip --remove-section=.comment --remove-section=.note debian/nuntium-decode-cli/usr/bin/nuntium-decode-cli
$ ./debian/nuntium/usr/bin/nuntium
no debug info in ELF executable errno -1
fatal error: no debug info in ELF executable

runtime stack:
no debug info in ELF executable errno -1
panic during panic
$

This problem does not manifest when building with golang-gc.

The problem is also reproducible when calling 'strip --strip-debug'; although this removes substantially fewer symbols, there are still some go-related symbols that are removed according to objdump -x:

@@ -871,7 +853,6 @@
 0000000000471380 l O .data 00000000000002f8 C.382
 000000000044e520 l O .rodata 0000000000000028 C191
 0000000000471680 l O .data 0000000000000028 C.383
-0000000000000000 l df *ABS* 0000000000000000 contenttype.go
 00000000004513b0 l O .rodata 0000000000000010 C0
 00000000004513c0 l O .rodata 0000000000000010 C1
 00000000004513d0 l O .rodata 0000000000000010 C2

But even passing --keep-file-symbols to strip does not give me a working binary.

So it looks like gccgo has a hard dependency on the contents of the debugging sections of the binary, which gc does not.

Matthias Klose (doko)
summary: - binaries built with gccgo-4.9 cannot be stripped
+ Go binaries cannot be stripped
Changed in golang (Debian):
status: Unknown → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote : Re: Go binaries cannot be stripped

You've retitled this bug report to say that go binaries cannot be stripped, but please note that in my report I stated that debugging symbols *can* be removed from binaries built with GC.

Revision history for this message
Robie Basak (racb) wrote :

Bug 1200255 is related. The same issue happens with the go toolchain. We ended up specifically not stripping binaries in juju, and I think other go binaries need to be built this way also.

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 1318027] Re: Go binaries cannot be stripped

On Mon, May 12, 2014 at 02:25:31PM -0000, Robie Basak wrote:
> Bug 1200255 is related. The same issue happens with the go toolchain.

It's not the same issue. In my tests here, I am able to strip gc binaries
(with carefully-constructed commandlines) in a way that retains all of the
go symbols and appears to leave the binaries operational. With gccgo, any
use of strip renders the binary unusable.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>

Revision history for this message
James Page (james-page) wrote : Re: Go binaries cannot be stripped

If I remember correctly, the stripping on gc built binaries was only problematic on armhf - the general upstream advice was 'don't strip - it breaks stuff' so we disabled it.

That was with 1.1 - things may have moved on with 1.2 of golang

Revision history for this message
Sergio Schvezov (sergiusens) wrote : Re: [Bug 1318027] Re: Go binaries cannot be stripped

On Mon, May 19, 2014 at 11:13 AM, James Page <email address hidden> wrote:

> If I remember correctly, the stripping on gc built binaries was only
> problematic on armhf - the general upstream advice was 'don't strip - it
> breaks stuff' so we disabled it.
>
> That was with 1.1 - things may have moved on with 1.2 of golang
>

Yeah, default debian rules for stripping worked fine with gc golang (at
least for nuntium)

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I asked about this upstream and the consensus was that stripping binaries compiled with the gc toolchain should work and does work as far as anyone knows: https://groups.google.com/forum/#!topic/golang-dev/ABppMOjYP6w . So the advice to avoid stripping Go binaries is officially rescinded. Report breakages!

Gccgo is a different matter: binaries built with gccgo must not be stripped. We could open a dialogue upstream as to how this requirement could be lifted, but this has not happened yet TTBOMK.

summary: - Go binaries cannot be stripped
+ gccgo binaries cannot be stripped
Changed in golang (Ubuntu):
status: New → Fix Released
affects: gcc-4.9 (Ubuntu) → gccgo-6 (Ubuntu)
Changed in gccgo-6 (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.