mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: check for power10 support on external linker for PPC64
The external linker will need to support the new PC relative relocations when they are generated by Go in a future patch. If it does not, many unhelpful relocation errors will be generated by the external linker. Use the -mcpu=power10 option as a surrogate for -mpcrel. It most cases, it should indicate whether the underlying linker has support for resolving PC relative relocations. Change-Id: I84b151ce04512ccaeb17835aaf44105a5f6b515b Reviewed-on: https://go-review.googlesource.com/c/go/+/469576 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Archana Ravindar <aravind5@in.ibm.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
5e4e2acc8e
commit
3b5706b423
1 changed files with 10 additions and 0 deletions
|
|
@ -1418,6 +1418,16 @@ func (ctxt *Link) hostlink() {
|
|||
argv = append(argv, "-Wl,-bbigtoc")
|
||||
}
|
||||
|
||||
// On PPC64, verify the external toolchain supports Power10. This is needed when
|
||||
// PC relative relocations might be generated by Go. Only targets compiling ELF
|
||||
// binaries might generate these relocations.
|
||||
if ctxt.IsPPC64() && ctxt.IsElf() && buildcfg.GOPPC64 >= 10 {
|
||||
if !linkerFlagSupported(ctxt.Arch, argv[0], "", "-mcpu=power10") {
|
||||
Exitf("The external toolchain does not support -mcpu=power10. " +
|
||||
" This is required to externally link GOPPC64 >= power10")
|
||||
}
|
||||
}
|
||||
|
||||
// Enable/disable ASLR on Windows.
|
||||
addASLRargs := func(argv []string, val bool) []string {
|
||||
// Old/ancient versions of GCC support "--dynamicbase" and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue