diff options
authorJason Wessel <>2013-02-12 05:08:21 -0600
committerRoss Burton <>2013-04-23 10:39:50 +0100
commit4142f6f9392fdd919488151170fb088d4113e0f2 (patch)
parent9c10356bde6d303d84daadb8c1170e08e774f5af (diff)
openembedded-core-4142f6f9392fdd919488151170fb088d4113e0f2.tar.bz2 Fix corruption of sdk binaries
There are two cases of corruption that the was not correctly dealing with. 1) SDK Extras should be left alone Extra external binaries included in an SDK that were linked against the host's version of /usr/lib/ should not get a relocation applied. In the case that was discovered these were LSB compliant binaries that already worked on many hosts. 2) If the interp section is too small generate an error In the case of the qemu user code, it was using its own .ld file to link the executables which overrides the default in the nativesdk binutils. This generated host executables which had a interp section that was too small to relocate. Now the will print an error and continue on such that the error can be fixed by a developer without having to do the difficult task of debugging why it is crashing or not loading correctly. Signed-off-by: Jason Wessel <> Signed-off-by: Richard Purdie <>
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/ b/scripts/
index 74bb7a5fdd..45d2c241c3 100755
--- a/scripts/
+++ b/scripts/
@@ -66,7 +66,7 @@ def parse_elf_header():
e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum, e_shstrndx =\
-def change_interpreter():
+def change_interpreter(elf_file_name):
if arch == 32:
ph_struct = struct.Struct("<IIIIIIII")
@@ -89,7 +89,16 @@ def change_interpreter():
if p_type == 3:
# PT_INTERP section
+ # External SDKs with mixed pre-compiled binaries should not get
+ # relocated so look for some variant of /lib
+ fname =
+ if fname.startswith("/lib/") or fname.startswith("/lib64/") or fname.startswith("/lib32/") or fname.startswith("/usr/lib32/") or fname.startswith("/usr/lib32/") or fname.startswith("/usr/lib64/"):
+ break
+ if (len(new_dl_path) >= p_filesz):
+ print "ERROR: could not relocate %s, interp size = %i and %i is needed." % (elf_file_name, p_memsz, len(new_dl_path) + 1)
+ break
dl_path = new_dl_path + "\0" * (p_filesz - len(new_dl_path))
@@ -199,7 +208,7 @@ for e in executables_list:
arch = get_arch()
if arch:
- change_interpreter()
+ change_interpreter(e)
""" change permissions back """