title: map the address of string literal to string literal, by parsing ELF C++ program
body: <p>Address of string literals are determined at compile time. This address and the string literal can be found in the built executable program (In ELF format). For example, the following code outputs <code>String Literal: 0x400674</code></p>
  
  <pre><code>printf("String Literal: %p\n", "Hello World");   
  </code></pre>
  
  <p>And <code>objdump -s -j .rodata test1</code> shows</p>
  
  <p>Contents of section .rodata:</p>
  
  <p><strong>400670</strong> 01000200 <strong>48</strong>656c6c 6f20576f 726c6400  ....<strong>H</strong>ello World.</p>
  
  <p>....</p>
  
  <p>So it looks like I can get the virtual address of "Hello World" by reading the executable program itself. </p>
  
  <p><strong>Question</strong>: How can I build a table/map/dictionary between the address of string literal and the the string itself, by reading the ELF format? </p>
  
  <p>I am trying to writeup a standalone python script or c++ program to read the elf program and generate the table. It's OK if extra mapping(not the string literal) in the table, as long as the table contains the whole mapping of string literals. </p>