diff options
| author | Cherry Mui <cherryyz@google.com> | 2022-06-16 11:35:40 -0400 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2022-06-16 16:27:17 +0000 |
| commit | 1d9d99b7ce279f2af928f79cbc5906d99f29bb67 (patch) | |
| tree | 7d5591a9ce5e232e0d717d9a82765d1f0740e975 /src/cmd/link | |
| parent | bcce8ef4982cf29715895277ad84aaf16991e06b (diff) | |
| download | go-1d9d99b7ce279f2af928f79cbc5906d99f29bb67.tar.xz | |
cmd/link: consider alignment in carrier symbol size calculation
Currently, when we calculate the size of a carrier symbol, we use
the previous symbol's end address as the start. But the symbol
actually starts after applying the alignment. Do this in the
size calculation.
Should fix AIX build.
Updates #53372.
Change-Id: I17942b1fe8027dce12b78c8e8c80ea6cebcee240
Reviewed-on: https://go-review.googlesource.com/c/go/+/412734
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/link')
| -rw-r--r-- | src/cmd/link/internal/ld/data.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index f12cb78fb8..cb2afeaa9a 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -1854,6 +1854,9 @@ func (state *dodataState) allocateDataSections(ctxt *Link) { } for _, symn := range sym.ReadOnly { symnStartValue := state.datsize + if len(state.data[symn]) != 0 { + symnStartValue = aligndatsize(state, symnStartValue, state.data[symn][0]) + } state.assignToSection(sect, symn, sym.SRODATA) setCarrierSize(symn, state.datsize-symnStartValue) if ctxt.HeadType == objabi.Haix { @@ -1935,6 +1938,9 @@ func (state *dodataState) allocateDataSections(ctxt *Link) { symn := sym.RelROMap[symnro] symnStartValue := state.datsize + if len(state.data[symn]) != 0 { + symnStartValue = aligndatsize(state, symnStartValue, state.data[symn][0]) + } for _, s := range state.data[symn] { outer := ldr.OuterSym(s) |
