<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>9242</bug_id>
          
          <creation_ts>2016-03-11 14:31:13 +0000</creation_ts>
          <short_desc>Relocate segments in native binaries when restoring from sstate</short_desc>
          <delta_ts>2026-07-23 15:21:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>2.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>   </status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          <blocked>9883</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>jku</cc>
    
    <cc>juro.bystricky</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>59899</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-11 14:31:13 +0000</bug_when>
    <thetext>We do magic relocation of certain libraries and binaries for nativesdk by marking certain strings with a magic segment (.gccrelocprefix) and changing that path during sdk relocation.

We should look at doing the same for native binaries from sstate. This would massively reduce the need for wrapper binaries in the sysroot, and fix situations where commonly used libraries have paths embedded in them (such as glib with GIO_MODULE_PATH).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59950</commentid>
    <comment_count>1</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-03-14 17:55:37 +0000</bug_when>
    <thetext>similar problem with hard-coded paths in glibc:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=8583</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83488</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-04-08 16:25:33 +0000</bug_when>
    <thetext>A list of recipes which could do with this:
- glib GIO module path
- curl ca-certificate path
- libxml2 catalog path</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83497</commentid>
    <comment_count>3</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2019-04-09 07:55:01 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; A list of recipes which could do with this:
&gt; - glib GIO module path
&gt; - curl ca-certificate path
&gt; - libxml2 catalog path

Thanks. I&apos;ll have a go at this (self-assigning for now ).  

I had a look yesterday and below is my understanding of the tasks (do correct if I&apos;m mistaken).


1. Add magic attribute to path variables in native binaries where needed
I guess this means patches like the glibc one:
+ static char default_gconv_path[4096] __attribute__ ((section (&quot;.gccrelocprefix&quot;))) = GCONV_PATH;


2. Store the original sysroot path somewhere when populating the sysroot
I don&apos;t see (good) ways around this: in the SDK relocation case it&apos;s done when the SDK is generated: ##DEFAULT_INSTALL_DIR## is replaced in the relocation script itself. 
Not sure how this should be done...


3. During recipe sysroot preparation modify binaries to replace original path with current sysroot path (like relocate_sdk.py)
This should be straight forward once #2 is solved -- but would be good to not copy-paste half of relocate_sdk.py somewhere else...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83510</commentid>
    <comment_count>4</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2019-04-10 11:01:21 +0000</bug_when>
    <thetext>After a bit of testing I have questions:

* the binaries in recipe-sysroot-native are hardlinks (with copies in other recipe-sysroot-natives, sysroot-components and  the original sysroot-destdir). I&apos;m not sure what I should be doing with that -- I think the the value of e.g. CURL_CA_BUNDLE should be different for every recipe-sysroot-native dir, or is there some alternative that I&apos;ve overlooked?

* Assuming I figure that out, where exactly should the binary-relocation happen? staging.bbclass::extend_recipe_sysroot() is ... scary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83511</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-04-10 12:58:23 +0000</bug_when>
    <thetext>1) Maybe unhardlink any files that get modified.  There won&apos;t be that many.

2) Talk to RP.  Yes, it is. :)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>