This is an archive of the discontinued LLVM Phabricator instance.

Disable atexit()-based lowering when LTO'ing kernel/kext code
ClosedPublic

Authored by yln on Apr 21 2023, 3:14 PM.

Details

Summary

The kernel and kext environment does not provide the __cxa_atexit() function, so we can't use it for lowering global module destructors.
Unfortunately, just querying for "compiling for kernel/kext?" in the LTO pipeline isn't possible (kernel/kext identifier isn't part of the triple yet) so we need to pass down a CodeGen flag.

rdar://93536111

Diff Detail

Event Timeline

yln created this revision.Apr 21 2023, 3:14 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptApr 21 2023, 3:14 PM
yln requested review of this revision.Apr 21 2023, 3:14 PM
yln retitled this revision from WIP: Disable atexit()-based lowering when LTO'ing kernel/kext code to Disable atexit()-based lowering when LTO'ing kernel/kext code.Apr 21 2023, 3:16 PM
yln edited the summary of this revision. (Show Details)
yln added reviewers: ab, rapidsna, arphaman.
yln added a reviewer: dcoughlin.
yln edited the summary of this revision. (Show Details)Apr 21 2023, 3:27 PM
ab accepted this revision.Apr 25 2023, 11:28 AM

A comment inline, but LGTM otherwise, thanks!

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
1208

stray fatal_error?

This revision is now accepted and ready to land.Apr 25 2023, 11:28 AM
yln marked an inline comment as done.Apr 25 2023, 11:50 AM