* readelf: print addend for RELA relocations without symbol
When processing relocations from a SHT_RELA type section, GNU
readelf displays the value of the 'r_addend' field if no
symbol index is given (that is, 'r_info_sym' is 0).
By also implementing this we can better test the output for
64-bit binaries which commonly use SHT_RELA relocations.
The included test file is the same as tls.elf but compiled
for x86_64. Its code is the following:
  __thread int i;
  int main(){}
and it is compiled using the following command line:
$ gcc -m64 -o tls64.elf tls.c
* test: add source file for tls{,64}.elf
The comments at the top describe how to compile the source
file into tls.elf and tls64.elf.
                         rel['r_info_type'], self.elffile)))
 
                 if rel['r_info_sym'] == 0:
+                    if section.is_RELA():
+                        fieldsize = 8 if self.elffile.elfclass == 32 else 16
+                        addend = self._format_hex(rel['r_addend'], lead0x=False)
+                        self._emit(' %s   %s' % (' ' * fieldsize, addend))
                     self._emitline()
                     continue
 
 
--- /dev/null
+// Compile into tls.elf using:
+// $ gcc -m32 -o tls.elf tls.c
+// For tls64.elf, use:
+// $ gcc -m64 -o tls64.elf tls.c
+
+__thread int i;
+
+int main(){}