Patchwork [CONSOLIDATED,REQUEST,55/64] chrpath.bbclass: Account for case when ORIGIN is in RPATH

login
register
mail settings
Submitter Saul Wold
Date Aug. 14, 2012, 12:13 p.m.
Message ID <5824e7f06b2263fc89efa12f2aeee13f6cf76c54.1344946189.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/34561/
State New
Headers show

Comments

Saul Wold - Aug. 14, 2012, 12:13 p.m.
From: Khem Raj <raj.khem@gmail.com>

This fixes a case when RPATH embedded in program have one of
its path already relative to ORIGIN. We were losing that path
if such a path existed. This patch appends it to the new edited
rpath being created when we see it.

so RPATH like below

(RPATH)              Library rpath:
[$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]

would end up being empty

but after this patch its kept intact

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/classes/chrpath.bbclass |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Richard Purdie - Aug. 15, 2012, 1:12 p.m.
On Tue, 2012-08-14 at 15:13 +0300, Saul Wold wrote:
> From: Khem Raj <raj.khem@gmail.com>
> 
> This fixes a case when RPATH embedded in program have one of
> its path already relative to ORIGIN. We were losing that path
> if such a path existed. This patch appends it to the new edited
> rpath being created when we see it.
> 
> so RPATH like below
> 
> (RPATH)              Library rpath:
> [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]
> 
> would end up being empty
> 
> but after this patch its kept intact
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Signed-off-by: Saul Wold <sgw@linux.intel.com>
> ---
>  meta/classes/chrpath.bbclass |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/meta/classes/chrpath.bbclass b/meta/classes/chrpath.bbclass
> index 10b5ca0..e903b65 100644
> --- a/meta/classes/chrpath.bbclass
> +++ b/meta/classes/chrpath.bbclass
> @@ -49,6 +49,7 @@ def process_dir (directory, d):
>              new_rpaths = []
>              for rpath in rpaths:
>                  # If rpath is already dynamic continue
> +                new_rpaths.append("%s" % (rpath.strip()))
>                  if rpath.find("$ORIGIN") != -1:
>                      continue
>                  # If the rpath shares a root with base_prefix determine a new dynamic rpath from the

Shouldn't this read:

                if rpath.find("$ORIGIN") != -1:
                      new_rpaths.append("%s" % (rpath.strip()))
                      continue

as the code above would add *all* the old rpaths to the binary as well
as any relocations?

Cheers,

Richard
Khem Raj - Aug. 15, 2012, 6:24 p.m.
On Wed, Aug 15, 2012 at 6:12 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> Shouldn't this read:
>
>                 if rpath.find("$ORIGIN") != -1:
>                       new_rpaths.append("%s" % (rpath.strip()))
>                       continue
>
> as the code above would add *all* the old rpaths to the binary as well
> as any relocations?

sorry I sent a wrong patch to ML and was testing a different one. I
will send out the correct one.

Patch

diff --git a/meta/classes/chrpath.bbclass b/meta/classes/chrpath.bbclass
index 10b5ca0..e903b65 100644
--- a/meta/classes/chrpath.bbclass
+++ b/meta/classes/chrpath.bbclass
@@ -49,6 +49,7 @@  def process_dir (directory, d):
             new_rpaths = []
             for rpath in rpaths:
                 # If rpath is already dynamic continue
+                new_rpaths.append("%s" % (rpath.strip()))
                 if rpath.find("$ORIGIN") != -1:
                     continue
                 # If the rpath shares a root with base_prefix determine a new dynamic rpath from the