X86/X86-64 linkers check code sequence while performing TLS optimization
like:

                  /* IE->LE transition:
                     Originally it can be one of:
                     movq [EMAIL PROTECTED](%rip), %reg
                     addq [EMAIL PROTECTED](%rip), %reg
                     We change it into:
                     movq $foo, %reg
                     leaq foo(%reg), %reg
                     addq $foo, %reg.  */
                  BFD_ASSERT (rel->r_offset >= 3);
                  val = bfd_get_8 (input_bfd, contents + rel->r_offset - 3);   
              BFD_ASSERT (val == 0x48 || val == 0x4c);
                  type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
                  BFD_ASSERT (type == 0x8b || type == 0x03);                  
reg = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
                  BFD_ASSERT ((reg & 0xc7) == 5);
                  reg >>= 3;                   BFD_ASSERT (rel->r_offset + 4 <=
input_section->size);

But not all TLS code sequences generated by all compilers follow the same
sequence. In many cases, such optimization is dangerous and wrong. We
should check the code sequence before performing such optimization.

-- 
           Summary: Linker should check code sequence before TLS
                    optimization
           Product: binutils
           Version: 2.19 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hjl at lucon dot org
                CC: bug-binutils at gnu dot org,jakub at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4928

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to