[LLVMbugs] [Bug 10389] New: [MC assembler] dot symbol used with leal interpreted differently from GNU as

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 18 03:16:37 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10389

           Summary: [MC assembler] dot symbol used with leal interpreted
                    differently from GNU as
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu


When OpenSSL generates its crypto/des/crypt586.s file, it uses the
following construction for PIC setup:

    call    .L000PIC_me_up
.L000PIC_me_up:
    popl    %edx
    leal    _GLOBAL_OFFSET_TABLE_+[.-.L000PIC_me_up](%edx),%edx

GNU as produces the following for this fragment:

   0:   e8 00 00 00 00          call   0x5
   5:   5a                      pop    %edx
   6:   8d 92 03 00 00 00       lea    0x3(%edx),%edx

So when gas processes the . symbol, it apparently considers the 'current
address' to be just after the initial opcode bytes for leal, e.g. at
offset 0x8.  Thus the addend becomes 0x8-0x5 = 0x3.

Clang's integrated assember, however, produces the following:

   0:   e8 00 00 00 00          call   0x5
   5:   5a                      pop    %edx
   6:   8d 92 01 00 00 00       lea    0x1(%edx),%edx

E.g. it considers the current address for the . symbol to be at offset
0x6, and the addend becomes 0x1 instead.  This makes the function crash
with a segfault at runtime.

All similar assembly functions in OpenSSL are generated by the same
'picmeup' Perl subroutine, so all of them suffer the same problem...

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list