This is an archive of the discontinued LLVM Phabricator instance.

[Mips] support "sp" named register
ClosedPublic

Authored by nickdesaulniers on Mar 3 2022, 11:24 AM.

Details

Summary

After Linux kernel commit
commit 200ed341b864 ("mips: Implement "current_stack_pointer"")
We observe the following build error when compiling the Linux kernel
targeting Mips:
fatal error: error in backend: Invalid register name global variable

Fixes: https://github.com/llvm/llvm-project/issues/54174
Link: https://github.com/ClangBuiltLinux/linux/issues/1608

Diff Detail

Event Timeline

nickdesaulniers requested review of this revision.Mar 3 2022, 11:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2022, 11:24 AM

I can build malta_defconfig on next-20220303 with this patch. I enabled CONFIG_DEBUG_STACKOVERFLOW and CONFIG_HARDENED_USERCOPY, which both use current_stack_pointer, and did not see any warnings/errors.

llvm/test/CodeGen/Mips/named-register-n64.ll
26

Should this be !llvm.named.register.$sp = !{!1}?

atanasyan accepted this revision.Mar 3 2022, 1:36 PM
This revision is now accepted and ready to land.Mar 3 2022, 1:36 PM

Do you have commit access?

nickdesaulniers marked an inline comment as done.

Do you have commit access?

Yep.

I can build malta_defconfig on next-20220303 with this patch. I enabled CONFIG_DEBUG_STACKOVERFLOW and CONFIG_HARDENED_USERCOPY, which both use current_stack_pointer, and did not see any warnings/errors.

I appreciate it!

llvm/test/CodeGen/Mips/named-register-n64.ll
26

Yes; good catch.

This revision was landed with ongoing or failed builds.Mar 3 2022, 1:53 PM
This revision was automatically updated to reflect the committed changes.