This is an archive of the discontinued LLVM Phabricator instance.

[Orc] Support atexit in Orc(JITLink)
ClosedPublic

Authored by StephenFan on Oct 8 2021, 8:18 AM.

Details

Summary

There is a bug reported at https://bugs.llvm.org/show_bug.cgi?id=48938

After looking through the glibc, I found the atexit(f) is the same as __cxa_atexit(f, NULL, NULL). In orc runtime, we identify different JITDylib by their dso_handle value, so that a NULL dso_handle is invalid. So in this patch, I added a PlatformJDDSOHandle to ELFNixRuntimeState, and functions which are registered by atexit will be registered at PlatformJD.

Diff Detail

Event Timeline

StephenFan created this revision.Oct 8 2021, 8:18 AM
StephenFan requested review of this revision.Oct 8 2021, 8:18 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 8 2021, 8:18 AM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript
StephenFan updated this revision to Diff 378233.Oct 8 2021, 8:26 AM

Add declaration.

lhames accepted this revision.Oct 8 2021, 10:47 AM

This is a nice solution! LGTM.

This revision is now accepted and ready to land.Oct 8 2021, 10:47 AM
This revision was automatically updated to reflect the committed changes.