[llvm-bugs] [Bug 52030] New: @llvm.global_dtors are ignored

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 1 09:50:37 PDT 2021


            Bug ID: 52030
           Summary: @llvm.global_dtors are ignored
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OrcJIT
          Assignee: unassignedbugs at nondot.org
          Reporter: andrzej.warzynski at gmail.com
                CC: 1101.debian at gmail.com, llvm-bugs at lists.llvm.org


I'm trying to run the following code with `lli`. Basically, it's a call to
`@printf` wrapped in `@printf_wrapper` and appended to `@llvm.global_dtors`:

@CounterFor_main = common global i32 0, align 4
@ResultHeaderStrIR = global [18 x i8] c"SOME RANDOM TEXT\0A\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void
()*, i8* } { i32 0, void ()* @printf_wrapper, i8* null }]

; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone ssp
uwtable willreturn
define i32 @main() local_unnamed_addr {
  ret i32 123

; Function Attrs: nounwind
declare i32 @printf(i8* nocapture readonly, ...)

define void @printf_wrapper() {
  %0 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x
i8]* @ResultHeaderStrIR, i32 0, i32 0))
  ret void

Here's what I get with MCJIT and which is consistent with what I expect:
$ lli -jit-kind=mcjit input.ll
However, `lli` defaults to ORCJit and with ORCJit there is not output at all.

Tested on X86 and AArch64, with trunk: 87817bc523daba1d2bd0492144a5d6adba8a649c

Thank you for taking a look!

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/20211001/fde89b15/attachment.html>

More information about the llvm-bugs mailing list