Commit b8bc8ef
fix(ovsm): Fix V1 sBPF relocation offset bug - LOGS NOW WORK!
BREAKTHROUGH: OVSM programs with syscalls now work on Solana!
The Bug:
We were calculating relocation offsets as: TEXT_VADDR + offset + 4
This caused the R_BPF_64_32 relocation to patch 4 bytes PAST
the immediate field, corrupting the next instruction.
The Fix:
R_BPF_64_32 relocations should point to the INSTRUCTION START.
The Solana loader automatically adds +4 to reach the imm field.
Changed:
- crates/ovsm/src/compiler/elf.rs:543
Removed the +4 offset calculation
Verification:
✅ Compiled minimal OVSM program with sol_log_64_
✅ Compared ELF format with Rust-compiled reference
✅ Deployed to Solana devnet successfully
✅ Invoked program - logs output correctly!
✅ Transaction: 7Cknz5AMDEVhpkV2xviraBFKpzXY1tUwp3CPqmsKcWcCL8c9TKhiivU8BE3UBpikvaCWMKA345rQDpL2w62FQ7N
✅ Program logged: 0x2a (42 in hex)
✅ Consumed 107 CU (matches estimate)
Test Results:
- Program ID: 4QWFNBrEjyKZWu6ydDv9nghsPru28eDpn1EzPLAJuw25
- Network: Solana devnet
- Status: SUCCESS
Files Modified:
- crates/ovsm/src/compiler/elf.rs - Fixed relocation offset
- crates/ovsm/src/compiler/mod.rs - Set default to V1
- src/commands/ovsm_handler.rs - Set compile command to V1
🎉 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 7d435cc commit b8bc8ef
File tree
4 files changed
+98
-4
lines changed- crates/ovsm/src/compiler
- src/commands
4 files changed
+98
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | | - | |
543 | | - | |
| 542 | + | |
| 543 | + | |
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
0 commit comments