New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug symbols are being obfuscated irrespective of extra GOGCFLAGS set #73814

Open
icanhazbroccoli opened this Issue Feb 7, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@icanhazbroccoli
Copy link

icanhazbroccoli commented Feb 7, 2019

What happened:
While building a kube-apiserver component from the sources using make, I noticed the output binary is still stripped, even though I put in the suggested GC flags.
The command I'm running is:

$ make all WHAT=cmd/kube-apiserver GOGCFLAGS="-N -l"
$ file _output/bin/kube-apiserver
_output/bin/kube-apiserver: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

The motivation is to get a debug version of a component which is recognisable by delve/gdb.

What you expected to happen:
I expected to get a non-stripped binary.

How to reproduce it (as minimally and precisely as possible):

Run make and inspect the file command output:

$ make all WHAT=cmd/kube-apiserver GOGCFLAGS="-N -l"
$ file _output/bin/kube-apiserver

Anything else we need to know?:

I discovered this file: hack/lib/golang.sh, where debug obfuscation and inlining are hardcoded to on:

goldflags="${GOLDFLAGS:-} -s -w $(kube::version::ldflags)"
gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}"

LD flags -s -w and GC flag -trimpath are producing an optimised inlined binary.

Applying this dummy workaround solved my problem: https://gist.github.com/icanhazbroccoli/e98a353284b723815131eb6804fbb33e

Environment:

  • Kubernetes version (use kubectl version): HEAD@fcb0d60d4c8
  • Cloud provider or hardware configuration: microk8s
  • OS (e.g. from /etc/os-release): CentOS Linux 7
  • Kernel (e.g. uname -a): Linux 3.10.0-862.14.4.el7.x86_64
  • Install tools:
  • Others:
@neolit123

This comment has been minimized.

Copy link
Member

neolit123 commented Feb 8, 2019

/sig release

@k8s-ci-robot k8s-ci-robot added sig/release and removed needs-sig labels Feb 8, 2019

@neolit123

This comment has been minimized.

Copy link
Member

neolit123 commented Feb 8, 2019

cc @dims @cblecker
as per: d9cfd77

is it a requirement to strip the binaries from debug symbols to get consistent packaging?
the debug symbols can be quite useful. (but putting aside the topic of debugging the api server).

@dims

This comment has been minimized.

Copy link
Member

dims commented Feb 8, 2019

@neolit123 @icanhazbroccoli please see #70276

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment