-
Notifications
You must be signed in to change notification settings - Fork 41
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
When linking with lld
, test suites are empty
#269
Comments
it works for me, but I pass clang in the CC variable. I wonder if the issue is related to the sanitizer or clang version.
what clang version are you using? Can you try without sanitizer? @evelikov any idea? |
Another thing that would be useful:
|
tl;dr: It's not actually Additional information from the failing situation - I was using the Android prebuilt
Your
Setting If I set
successfully builds and executes the tests. The main difference I could think of between these two compilers other than the age was that the modern, non-packaged clang uses The actual fix I was getting by switching to |
clang
, test suites are emptylld
, test suites are empty
if it were the _start/_end symbols, I would understand and possibly have to add a workaround for that. But here it seems you don't even have the elf section. How does that compiler build the kernel? Are we missing any flag here so it a) create the section and b) doesn't discard it when linking? The relevant code in kmod is this:
So we add them to a separate section, align it accordingly and instruct the linker that "this is used, trust me, do not discard". Can you check if it's the linker discarding the section or the compiler not adding it?
I'm wondering if it's related to LTO |
Now I can reproduce it with my distro's packages:
and it's not related to lto as even passing -Db_lto=falses it still fails. |
When building with clang and linking with lld there is an issue with keeping the kmod_tests sections: On ELF targets, __attribute__((used)) prevents compiler discarding, but does not affect linker --gc-sections, according to https://lld.llvm.org/ELF/start-stop-gc. Make sure the _start/_stop symbols are not weak and add the "retain" attribute. Closes: #269 Signed-off-by: Lucas De Marchi <[email protected]>
I can confirm that this fixes it for me. I didn't know about |
When building with clang and linking with lld there is an issue with keeping the kmod_tests sections: On ELF targets, __attribute__((used)) prevents compiler discarding, but does not affect linker --gc-sections, according to https://lld.llvm.org/ELF/start-stop-gc. Make sure the _start/_stop symbols are not weak and add the "retain" attribute. Closes: #269 Signed-off-by: Lucas De Marchi <[email protected]>
Avoid issues like #269 by asserting the test binary is non-empty: Suggested-by: Emil Velikov <[email protected]> Signed-off-by: Lucas De Marchi <[email protected]>
While trying to add a test, I noticed that it wasn't initially failing like it was supposed to. Eventually, I realized that none of the test suites thought they contained any tests.
Transcript of build with "passing" test suites because they don't exist
Switching
CC
to explicitly point atgcc
causes the test suites to populate.The text was updated successfully, but these errors were encountered: