Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cmd/link: link failure caused by duplicated LDFLAGS passed to external linker #25930

@albertjin

Description

@albertjin

What version of Go are you using (go version)?

go1.10.3

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

macOS/amd64, doing cross compile for android/arm64

What did you do?

export GOOS=android
export GOARCH=arm64
export CC=/path/to/androd/gcc
export CXX=/path/to/androd/g++
export CGO_ENABLED=1
export CGO_LDFLAGS="-Wl,--version-script=/the/version-script/export.txt"
go build -buildmode=c-shared -ldflags="-s -w -v" -v -o libxxx.so foo/bar

What did you expect to see?

The shared library is generated without any error.

What did you see instead?

In the output line

0.19 host link: ...

"-Wl,--version-script=/the/version-script/export.txt" is repeated 4 time and there are 3 errors,

anonymous version tag cannot be combined with other version tags

Note that if the version script contains a version name, the error message is 'duplicate version tag xxx'.

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.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions