mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
relocate_sdk.py: ensure interpreter size error causes relocation to fail
If there is insufficent space to change the interpreter, we were printing an error here but the overall script did not return an error code, and thus the SDK installation appeared to succeed - but some of the binaries will not be in a working state. Allow the relocation to proceed (so we still get a full list of the failures) but error out at the end so that the installation is halted. (From OE-Core rev: 3f258378bcaebb9c42c0011c7c424c920ef71d22) Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit c5a9a448e462d3e5457e8403c5a1a54148ecd224) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
36eb09d20e
commit
84eb7f3b98
|
@ -104,11 +104,12 @@ def change_interpreter(elf_file_name):
|
||||||
if (len(new_dl_path) >= p_filesz):
|
if (len(new_dl_path) >= p_filesz):
|
||||||
print("ERROR: could not relocate %s, interp size = %i and %i is needed." \
|
print("ERROR: could not relocate %s, interp size = %i and %i is needed." \
|
||||||
% (elf_file_name, p_memsz, len(new_dl_path) + 1))
|
% (elf_file_name, p_memsz, len(new_dl_path) + 1))
|
||||||
break
|
return False
|
||||||
dl_path = new_dl_path + b("\0") * (p_filesz - len(new_dl_path))
|
dl_path = new_dl_path + b("\0") * (p_filesz - len(new_dl_path))
|
||||||
f.seek(p_offset)
|
f.seek(p_offset)
|
||||||
f.write(dl_path)
|
f.write(dl_path)
|
||||||
break
|
break
|
||||||
|
return True
|
||||||
|
|
||||||
def change_dl_sysdirs(elf_file_name):
|
def change_dl_sysdirs(elf_file_name):
|
||||||
if arch == 32:
|
if arch == 32:
|
||||||
|
@ -222,6 +223,7 @@ else:
|
||||||
|
|
||||||
executables_list = sys.argv[3:]
|
executables_list = sys.argv[3:]
|
||||||
|
|
||||||
|
errors = False
|
||||||
for e in executables_list:
|
for e in executables_list:
|
||||||
perms = os.stat(e)[stat.ST_MODE]
|
perms = os.stat(e)[stat.ST_MODE]
|
||||||
if os.access(e, os.W_OK|os.R_OK):
|
if os.access(e, os.W_OK|os.R_OK):
|
||||||
|
@ -247,7 +249,8 @@ for e in executables_list:
|
||||||
arch = get_arch()
|
arch = get_arch()
|
||||||
if arch:
|
if arch:
|
||||||
parse_elf_header()
|
parse_elf_header()
|
||||||
change_interpreter(e)
|
if not change_interpreter(e):
|
||||||
|
errors = True
|
||||||
change_dl_sysdirs(e)
|
change_dl_sysdirs(e)
|
||||||
|
|
||||||
""" change permissions back """
|
""" change permissions back """
|
||||||
|
@ -260,3 +263,6 @@ for e in executables_list:
|
||||||
print("New file size for %s is different. Looks like a relocation error!", e)
|
print("New file size for %s is different. Looks like a relocation error!", e)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
print("Relocation of one or more executables failed.")
|
||||||
|
sys.exit(-1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user