diff options
| author | Ian Lance Taylor <iant@golang.org> | 2018-12-07 14:19:01 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2018-12-11 03:31:35 +0000 |
| commit | a11aa2aaecff98d6b46035704d587920c10788f9 (patch) | |
| tree | 4cba90e44608b474fb67b7c8bdf0f661e5cce4c3 /src/cmd | |
| parent | 6d4358705301e06e71b99977b77ae2c0a6b16b86 (diff) | |
| download | go-a11aa2aaecff98d6b46035704d587920c10788f9.tar.xz | |
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>
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/link/internal/ld/data.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 848087d743..5209878b78 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -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)) |
