From: Jason Wessel <jason.wessel@windriver.com>
To: <Openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/2] relocate_sdk.py: Fix corruption of sdk binaries
Date: Fri, 25 Jan 2013 07:06:55 -0600 [thread overview]
Message-ID: <5102836F.1020701@windriver.com> (raw)
In-Reply-To: <1359074326-12029-1-git-send-email-jason.wessel@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 2796 bytes --]
On 01/24/2013 06:38 PM, Jason Wessel wrote:
> There are two cases of corruption that the relocate_sdk.py 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/ld-so.so 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 relocate_sdk.py 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 <jason.wessel@windriver.com>
> ---
> scripts/relocate_sdk.py | 17 +++++++++++++----
> 1 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py
> index 74bb7a5..3e3181f 100755
> --- a/scripts/relocate_sdk.py
> +++ b/scripts/relocate_sdk.py
> @@ -66,7 +66,7 @@ def parse_elf_header():
> e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum, e_shstrndx =\
> hdr_struct.unpack(elf_header[16:hdr_size])
>
> -def change_interpreter():
> +def change_interpreter(elf_file_name):
> if arch == 32:
> ph_struct = struct.Struct("<IIIIIIII")
> else:
> @@ -89,8 +89,17 @@ def change_interpreter():
> if p_type == 3:
> # PT_INTERP section
> f.seek(p_offset)
> - dl_path = new_dl_path + "\0" * (p_filesz - len(new_dl_path))
> - f.write(dl_path)
> + dl_path = new_dl_path + "\0"
> + # External SDKs with mixed pre-compiled binaries should not get
> + # relocated so look for some variant of /lib
> + fname = f.read(11)
> + 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(dl_path) >= p_memsz):
> + print "ERROR: could not relocate %s, interp size = %i and %i is needed." % (elf_file_name, p_memsz, len(dl_path))
> + break
> + f.seek(p_offset)
> + f.write(dl_path )
oops... Need a yocto check patch for python white space eh?
Attached is the fixed version.
Cheers,
Jason.
[-- Attachment #2: 0001-relocate_sdk.py-Fix-corruption-of-sdk-binaries.patch --]
[-- Type: application/mbox, Size: 2942 bytes --]
prev parent reply other threads:[~2013-01-25 13:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 0:38 [PATCH 1/2] relocate_sdk.py: Fix corruption of sdk binaries Jason Wessel
2013-01-25 0:38 ` [PATCH 2/2] populate_sdk_base.bbclass: Improve debugging capabilities for SDK installer Jason Wessel
2013-01-25 9:34 ` Laurentiu Palcu
2013-01-25 9:29 ` [PATCH 1/2] relocate_sdk.py: Fix corruption of sdk binaries Laurentiu Palcu
2013-01-25 13:06 ` Jason Wessel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5102836F.1020701@windriver.com \
--to=jason.wessel@windriver.com \
--cc=Openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox