This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] tls directory entry size for windows 64-bit


  The DataDirectory entry for TLS table is supposed to give
the size of the IMAGE_TLS_DIRECTORY structure for
the current executable.
  This size is different for 32-bit and 64-bit windows executables.

  I tried to find out the correct conditionals to
to insure the system uses 64-bit addresses,
the same condition is used several times in the same
source code already.

  Is this patch OK?


Pierre Muller


2010-12-17  Pierre Muller  <muller@ics.u-strasbg.fr>

        * peXXigen.c (_bfd_XXi_final_link_postscript): Use correct size
        for windows 64-bit TLS table size.

Index: peXXigen.c
===================================================================
RCS file: /cvs/src/src/bfd/peXXigen.c,v
retrieving revision 1.67
diff -u -p -r1.67 peXXigen.c
--- peXXigen.c  22 Sep 2010 08:01:56 -0000      1.67
+++ peXXigen.c  17 Dec 2010 18:24:47 -0000
@@ -2437,8 +2437,15 @@ _bfd_XXi_final_link_postscript (bfd * ab
             abfd);
          result = FALSE;
        }
-
+     /* According to PECOFF specifications by Microsoft version 8.2
+       the TLS data directory consists of 4 pointers, followed
+       by two 4-byte integer. This implies that the total size
+       is different for 32-bit and 64-bit executables.  */
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
       pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x18;
+#else
+      pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x28;
+#endif
     }

 /* If there is a .pdata section and we have linked pdata finally, we
~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]