summaryrefslogtreecommitdiffstats
path: root/scripts/relocate_sdk.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/relocate_sdk.py')
-rwxr-xr-xscripts/relocate_sdk.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py
index 8c0fdb986a..8079d13750 100755
--- a/scripts/relocate_sdk.py
+++ b/scripts/relocate_sdk.py
@@ -97,11 +97,12 @@ def change_interpreter(elf_file_name):
97 if (len(new_dl_path) >= p_filesz): 97 if (len(new_dl_path) >= p_filesz):
98 print("ERROR: could not relocate %s, interp size = %i and %i is needed." \ 98 print("ERROR: could not relocate %s, interp size = %i and %i is needed." \
99 % (elf_file_name, p_memsz, len(new_dl_path) + 1)) 99 % (elf_file_name, p_memsz, len(new_dl_path) + 1))
100 break 100 return False
101 dl_path = new_dl_path + b("\0") * (p_filesz - len(new_dl_path)) 101 dl_path = new_dl_path + b("\0") * (p_filesz - len(new_dl_path))
102 f.seek(p_offset) 102 f.seek(p_offset)
103 f.write(dl_path) 103 f.write(dl_path)
104 break 104 break
105 return True
105 106
106def change_dl_sysdirs(elf_file_name): 107def change_dl_sysdirs(elf_file_name):
107 if arch == 32: 108 if arch == 32:
@@ -215,6 +216,7 @@ else:
215 216
216executables_list = sys.argv[3:] 217executables_list = sys.argv[3:]
217 218
219errors = False
218for e in executables_list: 220for e in executables_list:
219 perms = os.stat(e)[stat.ST_MODE] 221 perms = os.stat(e)[stat.ST_MODE]
220 if os.access(e, os.W_OK|os.R_OK): 222 if os.access(e, os.W_OK|os.R_OK):
@@ -240,7 +242,8 @@ for e in executables_list:
240 arch = get_arch() 242 arch = get_arch()
241 if arch: 243 if arch:
242 parse_elf_header() 244 parse_elf_header()
243 change_interpreter(e) 245 if not change_interpreter(e):
246 errors = True
244 change_dl_sysdirs(e) 247 change_dl_sysdirs(e)
245 248
246 """ change permissions back """ 249 """ change permissions back """
@@ -253,3 +256,6 @@ for e in executables_list:
253 print("New file size for %s is different. Looks like a relocation error!", e) 256 print("New file size for %s is different. Looks like a relocation error!", e)
254 sys.exit(-1) 257 sys.exit(-1)
255 258
259if errors:
260 print("Relocation of one or more executables failed.")
261 sys.exit(-1)