runtime_loader: Randomly position only relocatable code
The use of an unreliable test for relocatability effectively broke runtime_loader's support for non-position-independent executables, as it would insist on randomly positioning these files' segments in memory anyway causing the program to quickly crash. With this change runtime_loader uses the object type specified in the file's header to determine whether its segments can be safely relocated, restoring support for non-PI executables. Fixes #12427. Signed-off-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
1e6dd3feed
commit
078b88b12d
@@ -31,6 +31,17 @@
|
||||
#define EI_VERSION 6
|
||||
#define EI_PAD 7
|
||||
|
||||
// e_type (Object file type)
|
||||
#define ET_NONE 0 // No file type
|
||||
#define ET_REL 1 // Relocatable file
|
||||
#define ET_EXEC 2 // Executable file
|
||||
#define ET_DYN 3 // Shared object file
|
||||
#define ET_CORE 4 // Core file
|
||||
#define ET_LOOS 0xfe00 // OS-specific range start
|
||||
#define ET_HIOS 0xfeff // OS-specific range end
|
||||
#define ET_LOPROC 0xff00 // Processor-specific range start
|
||||
#define ET_HIPROC 0xffff // Processor-specific range end
|
||||
|
||||
// e_machine (Architecture)
|
||||
#define EM_NONE 0 // No machine
|
||||
#define EM_M32 1 // AT&T WE 32100
|
||||
|
||||
Reference in New Issue
Block a user