gimli-rs / unwind-rs

Apache License 2.0
26 stars 10 forks source link

Find the .text segment when it isn't first in the binary #23

Closed roblabla closed 5 years ago

roblabla commented 5 years ago

Currently, LD assumes that the first PT_LOAD segment in the binary is the .text. This used to be the case in older compilers (and is usually the case), but the latest nightly version of rust actually puts a RO segment before the .text segment, containing various misc metadata.

This patch properly changes the method of finding the .text by looking for PT_LOAD segments that are executable.

roblabla commented 5 years ago

Welp, fixed it.