title: Offset in nm symbol value?
body: <p>Just to give you some context, here's what I'm trying to achieve:
  I am embedding a const char* in a shared object file in order to have a version string in the .so file itself. I am doing data analysis and this string enables me to let the data know which version of the software produced it. This all works fine.</p>
  
  <p>The issue I am having is when I try to read the string out of the .so library directly. I tried to use</p>
  
  <pre><code>nm libSMPselection.so | grep _version_info
  </code></pre>
  
  <p>and get</p>
  
  <pre><code>000000000003d968 D __SMPselection_version_info
  </code></pre>
  
  <p>this is all fine and as expected (the char* is called _SMPselection_version_info).
  However I would have expected to now be able to open the file, seek to 0x3d968 and start reading my string, but all I get is garbage.</p>
  
  <p>When I open the .so file and simply search for the contents of the string (I know how it starts), I can find it at address 0x2e0b4. At this address it's there, zero terminated and as expected. (I am using this method for now.)</p>
  
  <p>I am not a computer scientist. Could someone please explain to me why the symbol value shown by nm isn't correct, or differently, what is the symbol value if it isn't the address of the symbol?</p>
  
  <p>(By the way I am working on a Mac with OSX 10.7)</p>