Skip to content

[SOL] Backport SBPFv3 to LLVM 19 - #206

Draft
LucasSte wants to merge 18 commits into
anza-xyz:solana-rustc/19.1-2024-12-03from
LucasSte:v3-backport-19
Draft

[SOL] Backport SBPFv3 to LLVM 19#206
LucasSte wants to merge 18 commits into
anza-xyz:solana-rustc/19.1-2024-12-03from
LucasSte:v3-backport-19

Conversation

@LucasSte

@LucasSte LucasSte commented Aug 6, 2026

Copy link
Copy Markdown

No description provided.

LucasSte and others added 13 commits August 3, 2026 18:05
* Invert indexes for dynamic stack frames in v3

* Fix rebase conflicts
* Change stack growth direction

* Nagisa's review
* Remove option to optimize the stack usage

* Create feature NoStackGaps

* Remove dynamic frames from V3

* Fix warning message

* Nagisa's review
* Adjust offsets for sBPFv3

* Update llvm/lib/Target/SBF/SBFRegisterInfo.cpp

Co-authored-by: Joe C <jcaulfield135@gmail.com>

---------

Co-authored-by: Joe C <jcaulfield135@gmail.com>
The blanket sign extension whenever an integer argument is 32 bytes is
wrong for some other libcalls such as the u32->f64 conversion. The
libcall for that expects to get upper 32 bits to be zeroed. SBF code we
have right now would sign extend that argument despite it being an
unsigned integer anyway.

Instead I applied a more targetted fix for FPOWI/LDEXP that marks these
instructions as dealing with signed integers so that the
`shouldSignExtend...` function gets the correct `IsSigned` flag in the
first place for these libcalls.

Will explore submitting this after cleaning it up upstream as well.
@nagisa

nagisa commented Aug 7, 2026

Copy link
Copy Markdown

You will need to apply the following patch and after that with anza-xyz/rust#156 all libcore tests pass.

diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index b055972512a8..430f2c9120d7 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -60,6 +60,7 @@ TargetInfo *elf::getTarget() {
     return getARMTargetInfo();
   case EM_AVR:
     return getAVRTargetInfo();
+  case EM_BPF:
   case EM_SBF:
     return getSBFTargetInfo();
   case EM_HEXAGON:

LucasSte and others added 2 commits August 7, 2026 17:04
* Fix warning overflow

* Add a regression test
@LucasSte

Copy link
Copy Markdown
Author

I tested LLVM, Clang, LLDB and LLD on my dev box, and only got failures in LLDB. If we want it, I removed the failing cases in LucasSte@15da9c4. Those cases appear to be all unrelated.

@LucasSte

Copy link
Copy Markdown
Author

On MacOS, I only get the failure due to the getMacOSHostVersion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants