Skip to content
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

Go Plugins including unnecessary content #19437

Closed
snadrus opened this issue Mar 7, 2017 · 1 comment
Closed

Go Plugins including unnecessary content #19437

snadrus opened this issue Mar 7, 2017 · 1 comment

Comments

@snadrus
Copy link

snadrus commented Mar 7, 2017

Please answer these questions before submitting your issue. Thanks!

What did you do?

cat >addTwo.go
package main
func AddTwo(a,b int) int{
return a+b
}
go build -buildmode plugin addTwo.go
ls -al
nm -D addTwo.so

What did you expect to see?

A small filesize & relevant symbols defined.

What did you see instead?

1.5MB, or 0.97MB stripped
The Runtime library is defined and many types.
These should already be available caller-side.
I suspect the Go runtime is duplicated in plugins.

System details

go version go1.8 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/andy/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build483699404=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
GOROOT/bin/go version: go version go1.8 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.8 X:framepointer
uname -sr: Linux 4.4.0-64-generic
LSB Version:	core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.23-0ubuntu5) stable release version 2.23, by Roland McGrath et al.
gdb --version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
@ALTree
Copy link
Member

ALTree commented Mar 7, 2017

Thanks for the report.

This is a duplicate of #17150 (cmd/go: drop runtime from plugins), so I'm closing this thread in favour of the older one.

@ALTree ALTree closed this as completed Mar 7, 2017
@golang golang locked and limited conversation to collaborators Mar 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants