(specifically this conflicts with absl's CHECK and Halide depends on
both lld and Halide, so runs into this conflict)
Details
- Reviewers
MaskRay - Group Reviewers
Restricted Project
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This is only used in lld cpp files, and lld's header files aren't meant to be used outside it. So halide is doing something unsupported.
Could halide undef this macro after including the lld header and before including absl headers instead?
I don't think Halide's doing something wrong here - it's including lld/Common/Driver.h which states:
// Generic entry point when using LLD as a library, safe for re-entry, supports // crash recovery.
And that includes lld/Common/CommonLinkerContext.h which includes lld/Common/ErrorHandler.h
Could halide undef this macro after including the lld header and before including absl headers instead?
Perhaps? I guess alternatively lld/Common/Driver.h could undef it at the end, but including any other lld header would risk breakage (since they might expect the macro to still be defined) - would probably make implementing that header tricky - needing to redefine that macro back again in the implementation file, etc.
Not sure this would help. If the colliding header were included *before* LLD's, this would still break.
I don't think it's realistic for any code that intends to be usable as a library with other code to be defining an un-prefixed macro. (That goes for *both* of the colliding cases here to be clear, not just LLD.) Not sure why this would be controversial.
Ah, yeah, fair point.
I don't think it's realistic for any code that intends to be usable as a library with other code to be defining an un-prefixed macro. (That goes for *both* of the colliding cases here to be clear, not just LLD.) Not sure why this would be controversial.
Yeah - guess there's minimal chance of ABSL fixing theirs given the wide usage, at least inside Google? (then again, wide scale changes are a thing) - not that that would remove the value in fixing LLD too.
I think the only header user code can include is include/lld/Common/Driver.h (for lld::elf::link, etc). Others are just a problem of how llvm-project generally organizes header files: if a file happens to be shared by more than one component, it is typically moved to include/XXX, regardless whether it is intended to be used as library code.
In this case include/lld/Common/Driver.h transitively included include/lld/Common/ErrorHandler.h which defines CHECK.
This is a problem of the incomplete global state removal for Common 83d59e05b201760e3f364ff6316301d347cbad95.
I just fixed it in 6b9a80de4906c79101af3b1cadcb3ef1edc62fbc and avoided CHECK macros for user code including include/lld/Common/Driver.h .
Fair enough - thanks for that!
As much as I'd like lld to move more towards compatibility for more fine grained library use, I guess that's as much as we'll do today.