This is an archive of the discontinued LLVM Phabricator instance.

[AIX] report_fatal_error on `-fregister_global_dtors_with_atexit` for static init
ClosedPublic

Authored by Xiangling_L on Jul 16 2020, 11:40 AM.

Details

Summary

On AIX, the semantic of global_dtors contains __sterm functions associated with C++ cleanup actions and user-declared __attribute__((__destructor__)) functions. We should never merely register __sterm with atexit(), so currently -fregister_global_dtors_with_atexit does not work well on AIX: It would cause finalization actions to not occur when unloading shared libraries. We need to figure out a way to handle that when we start supporting user-declared __attribute__((__destructor__)) functions.

Currently we report_fatal_error on this option temporarily.

Diff Detail

Event Timeline

Xiangling_L created this revision.Jul 16 2020, 11:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2020, 11:40 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jasonliu accepted this revision.Jul 16 2020, 1:31 PM

LGTM with minor nit.

clang/test/CodeGenCXX/aix-sinit-register-global-dtors-with-atexit.cpp
11

nit: fix clang-format warning.

This revision is now accepted and ready to land.Jul 16 2020, 1:31 PM
hubert.reinterpretcast edited the summary of this revision. (Show Details)Jul 16 2020, 2:02 PM
hubert.reinterpretcast added inline comments.
clang/lib/CodeGen/CodeGenModule.cpp
1212

This should query if the platform uses sinit/sterm.

Xiangling_L updated this revision to Diff 278777.EditedJul 17 2020, 8:17 AM
Xiangling_L marked 2 inline comments as done.

Adjust the query;

This revision was automatically updated to reflect the committed changes.