cmd/link: document default flags passed to extld #24494
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
Documentation
Issues describing a change to documentation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?master
What operating system and processor architecture are you using (
go env
)?What did you do?
go build -ldflags="-extld=/path/to/ld.hugetlbfs -linkmode=external" foo.go
I was trying to map code section to huge pages.
What did you expect to see?
Everything works.
What did you see instead?
Linker didn't recognize -m64 option.
Looks like we pass a bunch of gcc/clang specific flags to any external linker.
I worked around this by passing -extld=gcc -extldflags="-B /path/to/ld.hugetlbfs", to use gcc as a linker that recognizes -m64 and calls ld.hugetlbfs without passing -m64, but this behavior was surprising to me and should be documented somewhere (in extld documentation?)
The text was updated successfully, but these errors were encountered: