-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[llvm-jitlink] Allow optional stub-kind filter in stub_addr() expressions #78369
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
[llvm-jitlink] Allow optional stub-kind filter in stub_addr() expressions #78369
Conversation
I made a dedicated review for the first commit in #78365. Once it's through I will rebase this one and the NFC commit will vanish. |
A test that actually exercises the |
What about using a generic string key rather than an index? So uses would look like:
We don't need the test infrastructure to be fast, and this might make it easier to read? |
3104039
to
773fc10
Compare
That's a great idea! I changed the stub index into a filter expression, so that we can match kinds flexibly like this:
Actual detection could be implemented like this: 142168f#diff-9dbc5aacbecdc751e46355a2f0416a448e5eaea70e9ee6c82916be34b1381fd9L1269 |
Very cool! LGTM. Thanks @weliveindetail! |
This change broke building on i686 (possibly all 32-bit arches) with GCC (possibly with clang too):
|
Thanks for reporting! I cross-compiled it on ubuntu20.04 with GCC-10 for arm-linux-gnueabihf, which is 32-bit and it doesn't reproduce the issue. I will have a closer look tomorrow. Is there a public-facing bot that reproduces it? |
I don't think so. I've used the following CMake invocation to reproduce it in source tree:
|
I haven't verified, but I believe a43c192 should fix this. (Generally, when taking references to SmallVector, you almost always want to use SmallVectorImpl instead.) |
Thanks! Yes, I was thinking about something like that as well. @mgorny Does it fix the issue for you? |
Thanks. I can confirm that it builds now. |
We use
jitlink-check
lines in LIT tests as the primary tool for testing JITLink backends. Parsing and evaluation of the expressions is implemented inRuntimeDyldChecker
. Thestub_addr(obj, name)
expression allows to obtain the linker-generated stub for the external symbolname
in object fileobj
. This is limiting JITLink backends to a single stub for an external symbol.This patch adds support for an index parameter:
stub_addr(obj, name, index=0)
. It allows us to inspect more than a single stub in our tests and, respectively, it enables JITLink backends to emit multiple stubs. This is necessary for the AArch32 backend, which must be able to emit two different kinds of stubs depending on the instruction set state (Arm/Thumb) of the relocation site. Since the new parameter is optional, we don't have to update existing tests.