title: How to cheat *.so library into using missing @GLIBC_2.6 function?
body: <p>I need to run relatively new package on not-so-new RHEL 5.6.</p>
  
  <p>I have 3rd party library (<code>lib3rdparty.so</code>) which is compiled against glibc 2.6 while RHEL 5.6 have only 2.5 installed. But in the library there is only a couple of references to <code>sched_getcpu@@GLIBC_2.6</code>. I've checked it like this</p>
  
  <pre><code>readelf -s lib3rdparty.so | egrep "@GLIBC_2.[6-9]"
  </code></pre>
  
  <p>to find references to something newer than <code>GLIBC_2.5</code> which is installed. The output is</p>
  
  <pre><code>0 FUNC    GLOBAL DEFAULT  UND sched_getcpu@GLIBC_2.6 (62)
  0 FUNC    GLOBAL DEFAULT  UND sched_getcpu@@GLIBC_2.6
  </code></pre>
  
  <p>So, I have only one function from <code>GLIBC_2.6</code>. Now I want to make library think, that I have this function. For that purpose I forged small library (<code>libcheat.so</code>) like it mentioned <a href="https://stackoverflow.com/questions/3660826/gcc-ld-create-a-new-libc-so-with-isoc99-sscanfglibc-2-7-symbol-from-glibc">here</a>. Now I have <code>libcheat.so</code> file which, if run through <code>readelf</code>, will show this string:</p>
  
  <pre><code>10 FUNC    GLOBAL DEFAULT   11 sched_getcpu@@GLIBC_2.6
  </code></pre>
  
  <p>With this library I managed to succesfully build executable which is dynamically linked with <code>lib3rdparty.so</code>. Without this library I can't build anything, because <code>ld</code> can't find reference to <code>sched_getcpu</code>.</p>
  
  <p>But the problem is with running this file: when I try to run it I have a following error:</p>
  
  <pre><code> ./hello_world: version `GLIBC_2.6' not found (required by ./lib3rdparty.so)
  </code></pre>
  
  <p>So, I believe there is one last step to make it work, but I don't know what to do. I've tried to use <code>/etc/ld.conf.preload</code> and exporting <code>LD_LIBRARY_PATH</code> so it would point to my library to load before others. But it won't run. Tried to run it through <code>strace</code> but have no meaningful output.</p>
  
  <p>Any ideas?</p>