ld.Elfinit()
ld.HEADR = ld.ELFRESERVE
+ if ld.Buildmode == ld.BuildmodeShared {
+ // When building a shared library we write a package list
+ // note that can get quite large. The external linker will
+ // re-layout all the sections anyway, so making this larger
+ // just wastes a little space in the intermediate object
+ // file, not the final shared library.
+ ld.HEADR *= 3
+ }
if ld.INITTEXT == -1 {
ld.INITTEXT = (1 << 22) + int64(ld.HEADR)
}
eh.machine = EM_PPC64
}
+ elfreserve := int64(ELFRESERVE)
startva := INITTEXT - int64(HEADR)
- resoff := int64(ELFRESERVE)
+ resoff := elfreserve
var pph *ElfPhdr
var pnote *ElfPhdr
eh.phentsize = 0
if Buildmode == BuildmodeShared {
+ // The package list note we make space for here can get quite
+ // large. The external linker will re-layout all the sections
+ // anyway, so making this larger just wastes a little space
+ // in the intermediate object file, not the final shared
+ // library.
+ elfreserve *= 3
sh := elfshname(".note.go.pkg-list")
resoff -= int64(elfgopkgnote(sh, uint64(startva), uint64(resoff)))
}
a += int64(elfwritegopkgnote())
}
- if a > ELFRESERVE {
- Diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE)
+ if a > elfreserve {
+ Diag("ELFRESERVE too small: %d > %d", a, elfreserve)
}
}