mirror of
https://github.com/golang/go
synced 2024-11-17 17:54:48 -07:00
cmd/link,runtime: remove unnecessary funcdata alignment
Change-Id: I2777feaae4f266de99b56b444045370c82447cff Reviewed-on: https://go-review.googlesource.com/c/go/+/354011 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
e31c9ab557
commit
77bd0da688
@ -591,8 +591,7 @@ func (state pclntab) calculateFunctabSize(ctxt *Link, funcs []loader.Sym) (int64
|
||||
size := int64(int(state.nfunc)*2*4 + 4)
|
||||
|
||||
// Now find the space for the func objects. We do this in a running manner,
|
||||
// so that we can find individual starting locations, and because funcdata
|
||||
// requires alignment.
|
||||
// so that we can find individual starting locations.
|
||||
for i, s := range funcs {
|
||||
size = Rnd(size, int64(ctxt.Arch.PtrSize))
|
||||
startLocations[i] = uint32(size)
|
||||
@ -607,9 +606,6 @@ func (state pclntab) calculateFunctabSize(ctxt *Link, funcs []loader.Sym) (int64
|
||||
}
|
||||
}
|
||||
size += int64(numPCData(ldr, s, fi) * 4)
|
||||
if numFuncData > 0 { // Func data is aligned.
|
||||
size = Rnd(size, int64(ctxt.Arch.PtrSize))
|
||||
}
|
||||
size += int64(numFuncData * 4)
|
||||
}
|
||||
}
|
||||
@ -747,10 +743,8 @@ func writeFuncs(ctxt *Link, sb *loader.SymbolBuilder, funcs []loader.Sym, inlSym
|
||||
|
||||
// Write funcdata refs as offsets from go.func.* and go.funcrel.*.
|
||||
funcdata = funcData(ldr, s, fi, inlSyms[s], funcdata)
|
||||
// funcdata must be pointer-aligned and we're only int32-aligned.
|
||||
// Missing funcdata will be ^0. See runtime/symtab.go:funcdata.
|
||||
off = uint32(startLocations[i] + funcSize + numPCData(ldr, s, fi)*4)
|
||||
off = uint32(Rnd(int64(off), int64(ctxt.Arch.PtrSize)))
|
||||
for j := range funcdata {
|
||||
dataoff := off + uint32(4*j)
|
||||
fdsym := funcdata[j]
|
||||
|
@ -1088,12 +1088,6 @@ func funcdata(f funcInfo, i uint8) unsafe.Pointer {
|
||||
return nil
|
||||
}
|
||||
p := add(unsafe.Pointer(&f.nfuncdata), unsafe.Sizeof(f.nfuncdata)+uintptr(f.npcdata)*4)
|
||||
if goarch.PtrSize == 8 && uintptr(p)&4 != 0 {
|
||||
if uintptr(unsafe.Pointer(f._func))&4 != 0 {
|
||||
println("runtime: misaligned func", f._func)
|
||||
}
|
||||
p = add(p, 4)
|
||||
}
|
||||
p = add(p, uintptr(i)*4)
|
||||
off := *(*uint32)(p)
|
||||
// Return off == ^uint32(0) ? 0 : f.datap.gofunc + uintptr(off), but without branches.
|
||||
|
Loading…
Reference in New Issue
Block a user