This is an archive of the discontinued LLVM Phabricator instance.

[lld] Force crashes when env var LLD_FORCE_CRASH set
AbandonedPublic

Authored by abrachet on Mar 15 2022, 11:27 AM.

Details

Reviewers
MaskRay
aganea
Summary

This will be used to test clang driver lld crash reproduction

Diff Detail

Event Timeline

abrachet created this revision.Mar 15 2022, 11:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 11:27 AM
Herald added a subscriber: emaste. · View Herald Transcript

Personally I am not feeling very comfortable adding such an environment variable just so that it can be tested.
I think it may make sense to add the clang driver change without a test.

Personally I am not feeling very comfortable adding such an environment variable just so that it can be tested.
I think it may make sense to add the clang driver change without a test.

We could also use LLD_IN_TEST=-1 as a signal for artificially testing the crash? Clang has #pragma clang __debug crash. I don't think crafting an invalid .o is reasonable to me, since we want to survive invalid inputs at all times.

lld/Common/ErrorHandler.cpp
113

I think you should use LLVM_BUILTIN_TRAP since __builtin_trap() isn't supported by all compilers.

114

Add extra LF please.

lld/tools/lld/lld.cpp
244

Can this go above L217? Do we need to have the __buildin_trap at two places? Here an in exitLld()?

abrachet abandoned this revision.Jun 17 2022, 10:33 AM

No longer needed for D120175