-
Notifications
You must be signed in to change notification settings - Fork 58
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
refactor: change to the official riscv32emac toolchain #184
Conversation
98a5133
to
91a38ed
Compare
Not worth commenting just yet. There's still a few issues but all are related just twists in DWARF data, which did not exist when compiled with Parity's toolchain. Summary:
So I do a temporary work branch to finalize this pull request, thus does not yet much sense to give any detailed feedback on the code itself. I've tried to add some rz-bin output to each commit so that it describes clearly the situation in the binary and kind of helps to understand from those grounds what the code change does (as otherwise these make no sense at all). |
4b8c69f
to
735f2e2
Compare
So this is the iteration #2 of the pull request. Opens:
I think it is better to have a checkpoint (feedback) first before fixing up these (in a separate commit). Changes to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me!
We can merge this once we fix clippy.
So I there was issue I was looking into on removing that CI script see first this temp diff:
The result:
I sanity checked again with old toolchain that my DWARF changes could not possibly cause any of this and they do not. I looked at also I keep also Friday off work (like I did Wed) to keep my hours in balance so looking into this next Monday. PS. A more standard convention would to use ELF note section (e.g. |
I'll check on Monday what the binary dumps comparing exports section (or whatever it was called) with old/new toolchain (dunno why did not came to mind Thu). I'd consider also leveraging Goblin for ELF parsing in the long run but it is irrelevant for the moment. Did also some further tests and yeah, DWARF parsing becomes much more sane when having two-passes: subprogram pass and subroutine pass. Also something not relevant for the moment. Since subprograms alone have a few special cases alone it'd be also easier to be robust on those. It neither can slow things down as you do same amount of work in O(n). |
zZz and wait for input... I wrote on Sunday (and sort of used half of my Monday, also rebased the patch set and fixed merge conflicts and hit my head wall with this issue under discussion) extra patch that simply allows to optionally pick benchmark with a command-line parameter. It's easier to fix build and linking issues because you don't have to comment out stuff by hand from |
3c709bd
to
0b3e9c9
Compare
After fixing up the parameters in ❯ guest-programs/build-examples.sh
> Building: 'example-hello-world' (-> output/example-hello-world.polkavm)
~/work/github.com/jarkko/polkavm ~/work/github.com/jarkko/polkavm/guest-programs
ERROR: failed to link "guest-programs/target/riscv32emac-unknown-none-polkavm/release/example-hello-world": failed to parse extern metadata: unsupported extern metadata version: '0' (expected '1' or '2') So the problem still persists. |
Contents of the section .polkavm_metadatastruct PolkaVM_Metadata {
unsigned char version;
unsigned int flags;
unsigned int symbol_length;
const char * symbol;
unsigned char input_regs;
unsigned char output_regs;
} __attribute__ ((packed)); FROM:
TO:
Contents of the section .polkavm_exports::core::arch::global_asm!(
".pushsection .polkavm_exports,\"R\",@note\n",
".byte 1\n", // Version.
".4byte {metadata}",
".4byte {function}",
".popsection\n",
metadata = sym METADATA,
function = sym trampoline,
); FROM:
TO:
|
0ae3083
to
0178be6
Compare
Follow-up: #199 |
Looking this next time on Monday, if it is still open but I'd hope that since I created follow-up issues and this passes the CI, it'd be a great time to merge it, in order to get a milestone (and move forward with #199). |
Please use "rebase and merge" instead of "squash and merge" so that my splits don't go wasted, and will in future useful for |
If the commits are nice I always use rebase and merge (and in general I personally prefer a rebase-based workflow myself), but FYI this is not true for Parity at large (if you're going to contribute to |
OK cool it was only what Github seems to recommend me as default (again apparently) :-) |
I'll revisit the remaining issues on Monday. Took 4 weeks in the end to get here but zero actual technical debt generated (maybe even a bit reduced in details). It somehow exploded from that once additional |
Also I think Monday would be good time because then the response time any possible issues is fastest (next week I'll be available full 5 days). |
Signed-off-by: Jarkko Sakkinen <[email protected]>
Check with invariant that `program_from_elf::Source` instances are created with the correct data before the range check. Signed-off-by: Jarkko Sakkinen <[email protected]>
The DWARF data for benchmark-pinky has overlapping ranges after the toolchain change to the official rustc toolchain. Skip them with a warning. Signed-off-by: Jarkko Sakkinen <[email protected]>
The DWARF data for benchmark-pinky has abstract origins with zero offsets, which is same undefined offset. Thus, make UnitOffset optional in find_type(). Signed-off-by: Jarkko Sakkinen <[email protected]>
Relax DWARF parser by turning errors into warnings for the situations encountered after changing the toolchain to the official rustc. Signed-off-by: Jarkko Sakkinen <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
Closes: paritytech#178 Signed-off-by: Jarkko Sakkinen <[email protected]>
Closes: paritytech#199 Suggested-by: Jan Bujak <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
I addressed the reported issues so I'll merge this (including #199). |
Change from the Parity's rv32e fork to the official rustc toolchain.
Makes sure that also PolkaVM exports get relocation entry with the '--relocatable' parameters. Otherwise the linker will only add the relocs, whic are referenced by the code directly.
Flag DWARF processing under the feature flag 'dwarf' for the moment.
Link: https://github.com/paritytech/rustc-rv32e-toolchain/
Closes: #178