This is an archive of the discontinued LLVM Phabricator instance.

[XCOFF][AIX] Use unique section names for LSDA and EH info sections with -ffunction-sections
ClosedPublic

Authored by xingxue on May 3 2022, 7:45 AM.

Details

Summary

When -ffunction-sections is on, this patch makes the compiler to generate unique LSDA and EH info sections for functions on AIX by appending the function name to the section name as a suffix. This will allow the AIX linker to garbage-collect unused function.

Diff Detail

Event Timeline

xingxue created this revision.May 3 2022, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 3 2022, 7:45 AM
xingxue requested review of this revision.May 3 2022, 7:45 AM
xingxue edited the summary of this revision. (Show Details)May 3 2022, 7:46 AM
llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
291

Fix typo.

llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
43

Should we also try to use the explicit section name if the function has one?

44

Fix option name.

53

I think the cast is not necessary.

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
2571

Should we also try to use the explicit section name if the function has one?

xingxue updated this revision to Diff 426807.May 3 2022, 12:56 PM
xingxue marked 5 inline comments as done.

Addressed comments:

  • Fixed typos in comments;
  • Removed unnecessary cast.
xingxue added inline comments.May 3 2022, 12:57 PM
llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
291

Fixed, thanks!

llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
43

I am inclined to use the function name because this is consistent with the behavior on Linux.

44

Fixed, thanks!

53

Removed the unnecessary cast, thanks!

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
2571

I am inclined to use the function name because this is consistent with the behavior on Linux.

LGTM; however, might want to wait a bit to see if other reviewers have comments.

llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
43

Yes, it does seem that the explicit section name is not used by Linux (with and without -ffunction-sections).

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
2571

Yes, it does seem that the explicit section name is not used by Linux (with and without -ffunction-sections).

This revision is now accepted and ready to land.May 4 2022, 8:35 AM
MaskRay accepted this revision.May 4 2022, 9:02 AM
This revision was landed with ongoing or failed builds.May 5 2022, 6:03 AM
This revision was automatically updated to reflect the committed changes.