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

missing mflr/mtlr (link register save/restore) when using inline asm w/ "lr" clobber #49491

Closed
nickdesaulniers opened this issue Apr 27, 2021 · 6 comments
Assignees
Labels
backend:PowerPC bugzilla Issues migrated from bugzilla

Comments

@nickdesaulniers
Copy link
Member

Bugzilla Link 50147
Resolution FIXED
Resolved on Jun 03, 2021 23:16
Version trunk
OS All
Blocks #4440 #48661
CC @nathanchance,@nemanjai,@stephenhines,@stefanp-ibm,@tstellar,@uweigand
Fixed by commit(s) 15051f0 f2ce10d

Extended Description

example:
void foo (void) {
asm ("":::"lr");
}

powerpc64le-linux-gnu-gcc -O2:
foo:
mflr 0
std 0,16(1)
ld 0,16(1)
mtlr 0
blr

clang --target=powerpc64le-linux-gnu -O2:
foo:
blr

This is causing ppc32 Linux kernels to hang when powering down, resulting in CI failures, as reported by Nathan Chancellor and debugged by Christophe Leroy in https://lists.ozlabs.org/pipermail/linuxppc-dev/2021-April/228246.html.

@nickdesaulniers
Copy link
Member Author

assigned to @stefanp-ibm

@nemanjai
Copy link
Member

Yes, we are aware of this unfortunate omission in the PPC back end. In fact, this same issue exists for other special registers (R2, R1, etc.)

@stefanp-ibm
Copy link
Contributor

Put up an initial patch on Phabricator:
https://reviews.llvm.org/D101657

The patch should fix the issue where the LR is clobbered in inline ASM.

@stefanp-ibm
Copy link
Contributor

Should probably backport this to 12.0.1.
Marked this bug as blocking that release.

@nathanchance
Copy link
Member

https://reviews.llvm.org/rG15051f0b4a2e0a0af9da7cd5e5cfaabb9f6aaa3d

Tom, could you please make sure this gets applied to release/12.x? I have verified that the issue that was initially reported is resolved and all the tests pass.

@tstellar
Copy link
Collaborator

tstellar commented Jun 4, 2021

Merged: f2ce10d

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:PowerPC bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

5 participants