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.
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.