-
Notifications
You must be signed in to change notification settings - Fork 15
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
error: cannot jump from this asm goto statement to one of its possible targets #1886
Comments
Seems like this is eminent: https://lore.kernel.org/20230712134552.534955-1-mpe@ellerman.id.au/ I still think this is worth looking into because there is nothing preventing this from reoccurring with another architecture at some point. Based on #1887, it seems like something is going wrong with the scope of local labels in statement expressions? |
Corentin's comment at https://reviews.llvm.org/D154696#4494899 would likely explain this issue too, as we are dealing with local labels here too. |
reduced test case: void bar(void **);
void* baz();
int foo (void) {
{
asm goto("jmp %l0"::::l0);
return 0;
l0:
return 1;
}
void *x __attribute__((cleanup(bar))) = baz();
{
asm goto("jmp %l0"::::l1);
return 42;
l1:
return 0xff;
}
} whether or not the labels are local is a red herring; if we have unique labels in a fn, we get the same error. Same for GNU C statement expressions. |
Looks like when support for asm goto was first introduced into clang, b8fee677bf8e2, a bug was introduced in My example above demonstrates more clearly than the original reproducer (where the labels had the same name, since they were local):
which is [more] obviously incorrect. |
Note to self since this might pop up again for future kernel patches with clang-16 or older:
Code that needs to be compiler version portable might need to rework code if it contains |
The current behavior of JumpScopeChecker::VerifyIndirectOrAsmJumps was to cross validate the scope of every jumping statement (goto, asm goto) against the scope of every label (even if the label was not even a possible target of the asm goto). When we have multiple asm goto's with unique targets, we could trigger false positive build errors complaining that labels that weren't even in the asm goto's label list could not be jumped to. Example: error: cannot jump from this asm goto statement to one of its possible targets asm goto(""::::foo); note: possible target of asm goto statement bar: ^ Fixes: ClangBuiltLinux/linux#1886 Reviewed By: void, jyu2, rjmccall Differential Revision: https://reviews.llvm.org/D155342
The current behavior of JumpScopeChecker::VerifyIndirectOrAsmJumps was to cross validate the scope of every jumping statement (goto, asm goto) against the scope of every label (even if the label was not even a possible target of the asm goto). When we have multiple asm goto's with unique targets, we could trigger false positive build errors complaining that labels that weren't even in the asm goto's label list could not be jumped to. Example: error: cannot jump from this asm goto statement to one of its possible targets asm goto(""::::foo); note: possible target of asm goto statement bar: ^ Fixes: ClangBuiltLinux/linux#1886 Reviewed By: void, jyu2, rjmccall Differential Revision: https://reviews.llvm.org/D155342
With perf: Simplify find_get_pmu_context() (hash may have changed, check for the most recent
core/guards
branch):Looking at the preprocessed source, I wonder if something is going sideways with
__label_warn_on
in__WARN_FLAGS()
?For what it is worth, this code may be killed for an independent reason: https://lore.kernel.org/bb8b901b51f1beaaf9fa86ce8ce9b8191817b3e1.1687539638.git.christophe.leroy@csgroup.eu/
The text was updated successfully, but these errors were encountered: