Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
linux_amd64
The problem
When link decides to use an external linker, it turns the -r flags it received into -rpath flags for the external linker. However, it doesn't pass the -I flag through to the external linker:
$ cat main.go
package main
func main() {}
$ $GOROOT/pkg/tool/linux_amd64/compile -shared -o main.o main.go
$ $GOROOT/pkg/tool/linux_amd64/link -I myrtld -r myrpath -buildmode pie -linkmode external -o main main.o
$ readelf -ld main | egrep interpreter\|RUNPATH\|PATH
[Requesting program interpreter: myrtld]
0x000000000000001d (RUNPATH) Library runpath: [myrpath]
$ $GOROOT/pkg/tool/linux_amd64/link -I myrtld -r myrpath -buildmode pie -linkmode external -o main main.o
$ readelf -ld main | egrep interpreter\|RUNPATH\|PATH
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
0x000000000000000f (RPATH) Library rpath: [myrpath]
Also, --enable-new-dtags should probably be passed to external GNU ld-compatible linkers for better fidelity with the internal ELF linker.
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
link doesn't propogate -I flags to the external linker
cmd/link: doesn't propogate -I flags to the external linker
Oct 26, 2017
ALTree
changed the title
cmd/link: doesn't propogate -I flags to the external linker
cmd/link: doesn't propagate -I flags to the external linker
Oct 26, 2017
What version of Go are you using (
go version
)?1.9.2
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?linux_amd64
The problem
When
link
decides to use an external linker, it turns the-r
flags it received into-rpath
flags for the external linker. However, it doesn't pass the-I
flag through to the external linker:Also,
--enable-new-dtags
should probably be passed to external GNU ld-compatible linkers for better fidelity with the internal ELF linker.The text was updated successfully, but these errors were encountered: