[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #12387 [Tor bundles/installation]: (Some) Pluggable Transport binaries are not stripped
#12387: (Some) Pluggable Transport binaries are not stripped
-------------------------------------+-------------------------------------
Reporter: gk | Owner: erinn
Type: defect | Status: new
Priority: normal | Milestone:
Component: Tor | Version:
bundles/installation | Keywords: TorBrowserTeam201407,
Resolution: | tbb-testcase
Actual Points: | Parent ID:
Points: |
-------------------------------------+-------------------------------------
Comment (by dcf):
Replying to [comment:5 dcf]:
> Replying to [comment:4 dcf]:
> > Specifically for Go programs, "[https://donatstudios.com/Golang-
Binary-Sizes#Comment23795 it isn't supported, isn't tested and is known to
produce broken executables.]" I don't know exactly what the problem is,
but we should check it out before trying to strip Go programs. I heard
that Yawning has been stripping obfs4 without ill effects.
> > * [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717172 Debian
#717172 - Stripping golang binaries causes crashes]
> > * [https://bugs.launchpad.net/ubuntu/+source/golang/+bug/1200255
Ubuntu #1200255 - go get ... fails with SIGILL on armhf]
>
> According to the lantern-devel mailing list,
"[https://groups.google.com/forum/#!topic/lantern-devel/FUN00B8rZtQ
Compiling Go binaries with the -w linker flag makes binaries quite a bit
smaller]." `-w` is "omit the DWARF symbol table." Additionally `-s` ("omit
the symbol table and debug information") looks useful among the
[http://golang.org/cmd/ld/ ld options].
Here are tests using go1.3 on linux64. Summary: `-s` implies `-w'; and
`-s` saves a lot, as much as `strip` does.
{{{
go build
6.1M meek-client
2.8M meek-client-torbrowser
go build -ldflags '-w'
4.7M meek-client
2.2M meek-client-torbrowser
go build -ldflags '-s'
4.4M meek-client
2.0M meek-client-torbrowser
go build -ldflags '-s -w'
4.4M meek-client
2.0M meek-client-torbrowser
go build && strip
4.4M meek-client
2.0M meek-client-torbrowser
}}}
It looks like we only have to use `-s`, because `-s` mostly implies `-w`.
In the linker, the primary functions that check the `-w` option...
https://code.google.com/p/go/source/browse/src/cmd/ld/dwarf.c?name=6bdbf9086c00#2163
{{{
void
dwarfaddshstrings(LSym *shstrtab)
{
if(debug['w']) // disable dwarf
return;
}}}
https://code.google.com/p/go/source/browse/src/cmd/ld/dwarf.c?name=6bdbf9086c00#2344
{{{
void
dwarfaddmachoheaders(void)
{
MachoSect *msect;
MachoSeg *ms;
vlong fakestart;
int nsect;
if(debug['w']) // disable dwarf
return;
}}}
https://code.google.com/p/go/source/browse/src/cmd/ld/dwarf.c?name=6bdbf9086c00#2435
{{{
void
dwarfaddpeheaders(void)
{
if(debug['w']) // disable dwarf
return;
}}}
...are also gated on the outside by `-s`. There are a few other places
where `-w` is checked that aren't so gated, but it appears they don't
matter much for file size.
https://code.google.com/p/go/source/browse/src/cmd/ld/elf.c?name=6bdbf9086c00#963
{{{
if(!debug['s']) {
addstring(shstrtab, ".symtab");
addstring(shstrtab, ".strtab");
dwarfaddshstrings(shstrtab);
}
}}}
https://code.google.com/p/go/source/browse/src/cmd/ld/macho.c?name=6bdbf9086c00#478
{{{
if(!debug['s'] && linkmode != LinkExternal)
dwarfaddmachoheaders();
}}}
https://code.google.com/p/go/source/browse/src/cmd/ld/pe.c?name=6bdbf9086c00#639
{{{
if(!debug['s'])
dwarfaddpeheaders();
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12387#comment:7>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs