[patch bfd]: Fix generation of .tls directory entry

Kai Tietz ktietz70@googlemail.com
Tue Dec 14 16:22:00 GMT 2010


Hello,

by recent changes I noticed that the TLS directory entry for PE-COFF
targets isn't set anymore. This patch fixes this issue

2010-12-14  Kai Tietz

        * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Handle TLS directory
        entry.

Tested for x86_64-w64-mingw32, and i686-pc-cygwin. Ok for apply?

Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
-------------- next part --------------
Index: peXXigen.c
===================================================================
RCS file: /cvs/src/src/bfd/peXXigen.c,v
retrieving revision 1.67
diff -u -3 -r1.67 peXXigen.c
--- peXXigen.c	22 Sep 2010 08:01:56 -0000	1.67
+++ peXXigen.c	14 Dec 2010 16:17:39 -0000
@@ -616,6 +616,11 @@
        .idata is needed for backwards compatibility.  FIXME.  */
     add_data_entry (abfd, extra, 1, ".idata", ib);
 
+  if (extra->DataDirectory[PE_TLS_TABLE].VirtualAddress == 0)
+    /* Until other .tls fixes are made, the entry for .tls
+       is needed.  */
+    add_data_entry (abfd, extra, 9, ".tls", ib);
+
   /* For some reason, the virtual size (which is what's set by
      add_data_entry) for .reloc is not the same as the size recorded
      in this slot by MSVC; it doesn't seem to cause problems (so far),


More information about the Binutils mailing list