mirror of
https://github.com/golang/go
synced 2024-11-23 06:20:07 -07:00
cmd/link: only create .init_array section if not empty
This avoids a warning from old versions of the GNU linker or glibc. No test because these old versions are not readily available. I tested this by hand on CentOS 6. Fixes #28722 Change-Id: I16640c9b83a79f759ec68fac64874803e74fbbfb Reviewed-on: https://go-review.googlesource.com/c/153257 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6d43587053
commit
a11aa2aaec
@ -1313,7 +1313,7 @@ func (ctxt *Link) dodata() {
|
||||
case BuildModeCArchive, BuildModeCShared, BuildModeShared, BuildModePlugin:
|
||||
hasinitarr = true
|
||||
}
|
||||
if hasinitarr {
|
||||
if hasinitarr && len(data[sym.SINITARR]) > 0 {
|
||||
sect := addsection(ctxt.Arch, &Segdata, ".init_array", 06)
|
||||
sect.Align = dataMaxAlign[sym.SINITARR]
|
||||
datsize = Rnd(datsize, int64(sect.Align))
|
||||
|
Loading…
Reference in New Issue
Block a user