[LLVMbugs] [Bug 11322] New: Wrong constructor order for ARM/ELF

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 6 23:58:04 PST 2011


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

             Bug #: 11322
           Summary: Wrong constructor order for ARM/ELF
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


ARM/ELF uses .init_array section for constructors. Unlike .ctors section,
.init_array is executed in _forward_ order. LLVM does not take this into
account. As a result, constructors on ARM/ELF are executed in _reverse_
priority order.

Reproducer:
cat >1.c
__attribute__((constructor(152))) void f152() {}
__attribute__((constructor(151))) void f151() {}
^D
./Release+Asserts/bin/clang -ccc-host-triple arm-elf-linux-gnueabi 1.c -S
cat 1.S
... # unrelated output skipped
        .section        .init_array,"aw",%init_array
        .align  2
        .long   f152
        .long   f151

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