Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] [PATCH 1/3] go-module.eclass: introduce new eclass to handle go modules
Date: Thu, 12 Sep 2019 22:01:35
Message-Id: CAAr7Pr_CRHJrm-Svw8Deuq-bzjxQX48o0yQC=ePSMKB-U7EEvQ@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH 1/3] go-module.eclass: introduce new eclass to handle go modules by "Michał Górny"
1 On Thu, Sep 12, 2019 at 2:13 PM Michał Górny <mgorny@g.o> wrote:
2
3 > On Thu, 2019-09-12 at 13:38 -0700, Alec Warner wrote:
4 > > On Thu, Sep 12, 2019 at 1:20 PM Kent Fredric <kentnl@g.o> wrote:
5 > >
6 > > > On Wed, 11 Sep 2019 17:28:22 -0700
7 > > > Alec Warner <antarus@g.o> wrote:
8 > > >
9 > > > > I don't care if you strip or not (I'm not even sure portage knows
10 > how to
11 > > > do
12 > > > > it for go binaries) but I'm fairly sure the reason isn't because
13 > > > "upstream
14 > > > > does not support stripping go binaries" because they clearly
15 > do...unless
16 > > > > upstream is portage here...?
17 > > >
18 > > > I know rust at least has some sort of magic in place where if you do
19 > > > strip a binary, the ability for it to produce useful stack traces when
20 > > > it crashes is reduced.
21 > > > ( In that, it can make use of debugging symbols without the aid of a
22 > > > debugger )
23 > > >
24 > > > I can imagine that could be a reason to not support it.
25 > > >
26 > >
27 > > You definitely should not call 'strip' on a go binary. If you build with
28 > > the aforementioned linker flags you still get proper panic backtraces,
29 > but
30 > > also smaller binaries that you cannot load into gdb. Why 'strip' can't do
31 > > this but the go compiler can seems to be a bug ;)
32 > >
33 >
34 > Since when it is a bug that when you strip debug info, you don't have
35 > debug info? I thought that's precisely what stripping debug info means
36 > but maybe in the special Go world it is different, and debug info is
37 > expected to remain after stripping it.
38 >
39
40 So I have not checked (I should ask go-nuts about it) but it's possible
41 that:
42
43 strip <some_go_binary> breaks panic() tracebacks # This is generally bad.
44 go_compiler -w -s <some_binary> removes debug info, produces a smaller
45 binary, but has working panic() tracebacks.
46
47 In this case we would:
48 - Prefer the latter over the former.
49 - Ideally make it so that strip emulates -w -s, but keeps panic metadata
50 for go programs.
51
52 Not sure if upstream has rejected those patches, I can follow up.
53
54 -A
55
56
57
58 >
59 > --
60 > Best regards,
61 > Michał Górny
62 >
63 >