Skip to content

cmd/link: external linker generates larger binaries than 6l/8l #5497

Open
@gopherbot

Description

@gopherbot

by unclejacksons:

What steps will reproduce the problem?

Using 6l from Go 1.1:
go build -ldflags '-s -linkmode internal' -tags release
github.com/valyala/ybc/apps/go/memcached
wc -c memcached 
  1562016 memcached

Using Go 1.1 the patch which passes '-s' to ld:
go build -ldflags '-s' -tags release github.com/valyala/ybc/apps/go/memcached
wc -c memcached 
  2096920 memcached

Using Go 1.1 release:
wc -c memcached
  3194317 memcached

What is the expected output?
The resulting binary linked with the external linker should be smaller, its size should
be closer to that of the binary linked with 6l.
Since Go 1.1 defaults to using the external linker because it's more mature, it should
generate smaller binaries.


Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Ubuntu 13.04 amd64

Which version are you using?  (run 'go version')
go version go1.1 linux/amd64 from
https://go.googlecode.com/files/go1.1.linux-amd64.tar.gz


What can be done to make the resulting binaries smaller?

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions