Page MenuHomePhabricator

[AIX]Generate debug info for static init related functions

Authored by Xiangling_L on Jul 13 2020, 11:04 AM.



Set the debug location for static init related functions(dtor and finalize) so we can generate valid debug info on AIX by invoking -g with clang or -debug-info-kind=limited with clang_cc1.

This also works for any other future targets who may use sinit and sterm functions for static initialization, where a direct call to dtor will be generated within finalize function body.

This patch also aims at validating that the debug info generated is correct for AIX sinit related functions.

Diff Detail

Event Timeline

Xiangling_L created this revision.Jul 13 2020, 11:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2020, 11:04 AM
dblaikie added inline comments.

Any ideas why this is only showing up for AIX & not other targets, given this code looks to be generic, not AIX-specific?


This could probably be simplified to:

struct X {

This would still produce a global ctor and dtor without the superfluous variable, etc.


Yes, because the AIX implementation generates a direct call to the stub function on the finalization path when it finds that a stub was still registered with atexit.

That would explain why other platforms to not encounter this message:

inlinable function call in a function with debug info must have a !dbg location
dblaikie added inline comments.Jul 13 2020, 5:15 PM

Ah, fair enough - thanks for the context!


Could you simplify the test a bit like this? If it's only about the global /dtor/, perhaps omit the ctor in X too.

& which exact call in the test is the important one? Perhaps just test that?

Xiangling_L edited the summary of this revision. (Show Details)Jul 14 2020, 7:13 AM
Xiangling_L marked 6 inline comments as done.

Simplified the testcase;

dblaikie accepted this revision.Jul 14 2020, 12:54 PM

Looks good - thanks!

This revision is now accepted and ready to land.Jul 14 2020, 12:54 PM
This revision was automatically updated to reflect the committed changes.