Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLANG_ENABLE_OPAQUE_POINTERS=OFF does not prevent Attempting to get element type of opaque pointer assertion #55366

Closed
illwieckz opened this issue May 10, 2022 · 7 comments

Comments

@illwieckz
Copy link
Contributor

illwieckz commented May 10, 2022

The documentation says:

As of April 2022 both LLVM and Clang have complete support for opaque pointers, and opaque pointers are enabled by default in Clang. It is possible to temporarily restore the old default using the -DCLANG_ENABLE_OPAQUE_POINTERS=OFF cmake option.

But I verified in multiple ways this is not true, building clang with CLANG_ENABLE_OPAQUE_POINTERS=OFF does not provide previous behaviour.

@nikic
Copy link
Contributor

nikic commented May 10, 2022

Do mesa / llvm-spir make use of the driver or the cc1 interface? CLANG_ENABLE_OPAQUE_POINTERS affects whether the driver passes -no-opaque-pointers to cc1. If they're using cc1, then they need to pass -no-opaque-pointers to the cc1 invocation.

@nikic
Copy link
Contributor

nikic commented May 10, 2022

I've committed 3d888b0 to clarify the behavior wrt cc1.

@illwieckz
Copy link
Contributor Author

Do mesa / llvm-spir make use of the driver or the cc1 interface? CLANG_ENABLE_OPAQUE_POINTERS affects whether the driver passes -no-opaque-pointers to cc1. If they're using cc1, then they need to pass -no-opaque-pointers to the cc1 invocation.

I don't know but for Mesa I worked it around by making Mesa pass -no-opaque-pointers on invocation (I don't know the rest of the Mesa code so I don't know how it is interfaced):

On mean term the Mesa code would have to be ported to opaque pointers, but this simple trick made Mesa building again without being too-much intrusive on Mesa code.

Note: I've noticed writing -Xclang -no-opaque-pointers instead of -no-opaque-pointers in Mesa code makes applications crash, maybe that can help to understand which kind of interface Mesa uses as -Xclang seems to not be expected.

@nikic
Copy link
Contributor

nikic commented May 10, 2022

Based on the linked merge request, mesa is indeed using the cc1 interface.

Note: I've noticed writing -Xclang -no-opaque-pointers instead of -no-opaque-pointers in Mesa code makes applications crash, maybe that can help to understand which kind of interface Mesa uses as -Xclang seems to not be expected.

Right, -Xclang is how you pass options through to cc1 when using the driver interface.

As far as I can tell, there is nothing actionable here on the LLVM side, apart from the documentation update that has already been committed (see https://llvm.org/docs/OpaquePointers.html#transition-state).

@nikic nikic closed this as completed May 10, 2022
@illwieckz
Copy link
Contributor Author

@nikic Thank you for the documentation clarification, I assume this line can also be removed from the page as “next step”:

  • Enable opaque pointers by default in LLVM.

Opaque pointers are already enabled by default since 702d5de so this step is not a “next step” anymore.

@nikic
Copy link
Contributor

nikic commented May 11, 2022

@illwieckz Opaque pointers are currently enabled by default in Clang, but not in LLVM.

@illwieckz
Copy link
Contributor Author

Ah you're right! That's good then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants