[LLVMbugs] [Bug 5977] New: llc generates incorrect exception handling tables when generating PIC code

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Jan 8 09:33:45 PST 2010


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

           Summary: llc generates incorrect exception handling tables when
                    generating PIC code
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: vargaz at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4012)
 --> (http://llvm.org/bugs/attachment.cgi?id=4012)
testcase

To reproduce (on amd64 linux):
llc -f -relocation-model=pic -o temp.s temp.bc

The generated assembly contains:
        .byte   0x9B                                        # @TType format
(indirect pcrel sdata4)
and later:
        .quad   type_info_1                                 # TypeInfo

the two don't match, also the TType Base Offset is wrong too, since it assumes
that TypeInfo entries are 4 byte long, which is not true on amd64.

I think this is caused by this code in DwarfException.cpp:

    if (LSDASection->getKind().isWriteable() ||
        Asm->TM.getRelocationModel() == Reloc::Static)
      TTypeFormat = dwarf::DW_EH_PE_absptr;
    else
      TTypeFormat = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
        dwarf::DW_EH_PE_sdata4;

Here, the else part is executed, but later, the typeinfo is emitted as:
      O << Asm->Mang->getMangledName(GV);

I think the fix is to always use absptr, the ELF linker can and does fixup the
type info even if the section it is in is read-only.


-- 
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