diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-08-03 14:52:54 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-08-03 23:35:53 +0000 |
commit | 65fa2b615b72c1fa61a718f2e3a756833f153cc3 (patch) | |
tree | 1ac6c8fe5a442316e55d254ca09447c19b600de2 | |
parent | 0bad63437ec0262c309efd4262b86352a25a73e3 (diff) | |
download | go-git-65fa2b615b72c1fa61a718f2e3a756833f153cc3.tar.gz |
cmd/internal/objfile: only consider executable segments for load address
Reportedly on some new Fedora systems the linker is producing extra
load segments, basically making the dynamic section non-executable.
We were assuming that the first load segment could be used to
determine the program's load offset, but that is no longer true.
Use the first executable load segment instead.
Fixes #26369
Change-Id: I5ee31ddeef2e8caeed3112edc5149065a6448456
Reviewed-on: https://go-review.googlesource.com/127895
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r-- | src/cmd/internal/objfile/elf.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/internal/objfile/elf.go b/src/cmd/internal/objfile/elf.go index 7d5162a1e8..a48a9df5d6 100644 --- a/src/cmd/internal/objfile/elf.go +++ b/src/cmd/internal/objfile/elf.go @@ -114,7 +114,7 @@ func (f *elfFile) goarch() string { func (f *elfFile) loadAddress() (uint64, error) { for _, p := range f.elf.Progs { - if p.Type == elf.PT_LOAD { + if p.Type == elf.PT_LOAD && p.Flags&elf.PF_X != 0 { return p.Vaddr, nil } } |