1
0
mirror of https://github.com/golang/go synced 2024-11-17 22:05:02 -07:00

cmd/link: preserve elf phdr flags when loading external objects

Preserve program header flags when passing them through loadelf.Load.
They shouldn't be coerced to 0 on non-ARM platforms which set them
such as ppc64le.

Change-Id: I022613356f910d812de2fc22eac949960eeb53b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/300950
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
This commit is contained in:
Paul E. Murphy 2021-03-10 14:41:38 -06:00 committed by Lynn Boger
parent 860704317e
commit bd0fc0b9c3

View File

@ -252,6 +252,8 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader,
return nil, 0, fmt.Errorf("loadelf: %s: %v", pn, fmt.Sprintf(str, args...))
}
ehdrFlags = initEhdrFlags
base := f.Offset()
var hdrbuf [64]byte