Charles Collicutt wrote: > On 14 June 2017 at 19:22, Ted Unangst <[email protected]> wrote: > > > Charles Collicutt wrote: > > > That works, thank you. gcc-local(1) only mentions -nopie as an option for > > > the linker, so I thought it ought to be passed with -Wl,... > > > > I think I would interpret that sentence to mean linker as in the gcc > > invoked > > to link stuff. gcc -c is the compiler, gcc is the linker... > > > > Fair enough. But evidently -nopie is also a valid (but undocumented?) > option for ld(1). > > This came up because Go passes -Wl,-nopie to gcc if you run `go build` on > OpenBSD. See: > > https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/lib.go#L1092 > > From what you're saying, this sounds like a bug in Go. They should just be > passing -nopie. Is that right?
good question? sorry, there's some subtleties that I can never really keep track of, but generally I follow the rule that it's best to let the compiler sort things out instead of trying to manipulate ld options. doesn't help if you really need to use ld directly. OpenBSD also changed some defaults, so what works elsewhere may be different here. But I think passing -nopie to gcc consistently (at least on openbsd) is the path of least resistance.
