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:
To be honest, I would prefer to not have to document this. These options are very likely to change in the future. Documenting them would give some presumption of consistency even if we explicitly disclaim it. Since we effectively reserve the right to pass any option that is accepted by the standard linker on the platform, there is nothing useful you can gain from any documentation.
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: