Open ghost opened 3 years ago
That's odd, since we are invoking the C linker to create the shared library.
Change https://golang.org/cl/265957 mentions this issue: cmd/link: merge note sections into one segment
@esmailzadeh1 update ld (binutils) to 2.32 and you should able to compress c-shared binaries by upx.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I wrote a simple Golang file. is as follows:
Then build it :
go build -buildmode=c-shared -o library.so main.go
After library.so created I want to compress it with UPX
run
upx -9 library.so
and got errorWhat did you expect to see?
92200 -> 49976 54.20% linux/amd64 library.so
What did you see instead?
upx: library.so: CantPackException: PT_NOTE 0xa71cc above stub
I opened a issue in GitHub UPX. They told me the problem the library.so does not have the correct format to allow compression.
This problem only when use -buildmode=c-shared in command-line.
Thanks.