diff options
| author | Peter Waller <[email protected]> | 2014-06-01 16:01:57 +0100 |
|---|---|---|
| committer | Peter Waller <[email protected]> | 2014-06-01 16:01:57 +0100 |
| commit | f2eceb525cf0d5624cb4cf06dd339e309972b967 (patch) | |
| tree | 5d069f25dab7f4c40589211079f0f545c6089619 | |
| parent | Merge pull request #6 from tmc/master (diff) | |
| download | goupx-f2eceb525cf0d5624cb4cf06dd339e309972b967.tar.xz goupx-f2eceb525cf0d5624cb4cf06dd339e309972b967.zip | |
Only consider PT_LOAD at Offset == 0
| -rw-r--r-- | hemfix/hemfix.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hemfix/hemfix.go b/hemfix/hemfix.go index 2425df1..8fa0be0 100644 --- a/hemfix/hemfix.go +++ b/hemfix/hemfix.go @@ -116,6 +116,10 @@ func fixelf(elf *ELF.File, fd io.ReadWriteSeeker) error { continue } + if p.Off != 0 { + continue + } + mask := -p.Align if ^mask&p.Vaddr != 0 && (^mask&(p.Vaddr-p.Off)) == 0 { log.Printf("Hemming PT_LOAD section") @@ -130,6 +134,7 @@ func fixelf(elf *ELF.File, fd io.ReadWriteSeeker) error { dst := off + int64(sz*i) writephdr(elf, dst, fd, p) + break } } return nil |