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

            Bug ID: 32614
           Summary: ICF causes section ordering to segfault on ARM
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedb...@nondot.org
          Reporter: smee...@fb.com
                CC: llvm-bugs@lists.llvm.org

% cat reduced.s
        .section        .text.f,"axG",%progbits,f,comdat
        .code   32
f:
        .fnstart
        bx      lr
        .fnend

        .section        .text.g,"axG",%progbits,g,comdat
        .code   32
g:
        .fnstart
        bx      lr
        .fnend

% clang -target armv7-linux-gnueabi -shared -nostdlib -fuse-ld=lld -Xlinker
--icf=all -o /dev/null reduced.s
(lld crashes during the link)

The assembly is reduced from a C++ source file, so it may not be 100% sensible
(I got rid of a bunch of directives), but it reproduces the segfault. It occurs
in compareByFilePosition [1] because of AOut being null.

My understanding is that, because of ICF, only one of f and g will actually be
output, hence the OutSec for the other will be null. Adding null checks before
the SectionIndex comparison should get rid of the segfault, but I'm not sure if
there's a better solution.

[1]
https://reviews.llvm.org/diffusion/L/browse/lld/trunk/ELF/OutputSections.cpp;299911$82?color=1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to