golang/go

cmd/link: c-shared build mode not working with UPX

Open

#42,238 opened on Oct 27, 2020

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsInvestigationcompiler/runtimehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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)?

What did you do?

I wrote a simple Golang file. is as follows:

package main
func main() {
}

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 error

What 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.

Contributor guide