Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/ld: A program cannot run when linker flag "-s" is used. #6245
When I build a program with -ldflags "-s", and then run it, the following error is generated: runtime: function symbol table header: 0x0x0 0x0x0 fatal error: invalid function symbol table OSis Windows 7 64-bit, Go built from source as 32-bit application. go version devel +bb2db1e233b2 Sun Aug 25 23:50:44 2013 +1000 windows/386 Also tried with several random previous builds.
yeah, perhaps the best solution is to remove the feature. the runtime needs the symbols for precise stack GC (it needs stack walking), for example. we can remove some info in the symbol table (for example, function name and pc<->line table?), but not the entire symbol table.
Labels changed: added priority-later, removed priority-triage.
Being able to trim down executables is very valuable for me. Regarding the immediate question of what to do with -s, how about something like: (1) Make passing -s a noop right now (2) Update the documentation for -s (3) Add a basic test that fails when -s produces broken binaries, so that we get CI watching over it (4) Revisit safe ways to shrink binaries after 1.2 With a bit of steering in the right direction, I'd be happy to submit a CL for 1-3. At the very least, the docs should get updated. Feedback requested.
This was referenced
Dec 8, 2014
This issue was closed.