[llvm-bugs] [Bug 31555] New: IFunc interaction with comdat is broken

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 5 12:41:28 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31555

            Bug ID: 31555
           Summary: IFunc interaction with comdat is broken
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: chandlerc at gmail.com, echristo at gmail.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Given

 $test5_c = comdat any
 @test5_if = linkonce_odr ifunc void (), void ()* @test5_f
 define linkonce_odr void @test5_f() comdat($test5_c) {
   ret void
 }


llc produces


         .weak   test5_if
         .type   test5_if, at function
         .type   test5_if, at gnu_indirect_function
 test5_if = test5_f

which maps to


 COMDAT group section [    3] `.group' [test5_c] contains 1 sections:
    [Index]    Name
    [    4]   .text.test5_f

 Symbol table '.symtab' contains 6 entries:
    Num:    Value          Size Type    Bind   Vis      Ndx Name
      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
      1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS test.ll
      2: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT    3 test5_c
      3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
      4: 0000000000000000     1 FUNC    WEAK   DEFAULT    4 test5_f
      5: 0000000000000000     1 IFUNC   WEAK   DEFAULT    4 test5_if

If the linker drops this comdat both test5_f and test5_if will be treated as
undefined. This means that we cannot delete just one of them, but that is
exactly what globaldce does (see test/Transforms/GlobalDCE/comdats.ll).

It looks like
https://github.com/llvm-project/llvm-project/blob/master/llvm/lib/IR/Globals.cpp#L157-L159
has to be changed to handle ifunc in the same way as aliases.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170105/fef56324/attachment.html>


More information about the llvm-bugs mailing list