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

WIP:riscv64-qemu target #3545

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open

Conversation

rminnich
Copy link

@rminnich rminnich commented Mar 13, 2023

tinygo build -target riscv64-qemu -monitor .
tinygo:ld.lld: error: /home/rminnich/.cache/tinygo/thinlto/llvmcache-933570AB9628376F0C2EAD9666A92A793D143BE9:\
(function (reflect.Value).Complex: .text.(reflect.Value).Complex+0x76): relocation R_RISCV_HI20 out of range: \
524291 is not in [-524288, 524287]; references reflect$string.170
>>> referenced by value.go:0 (/home/rminnich/tinygo/src/reflect/value.go:0)
>>> defined in /home/rminnich/.cache/tinygo/thinlto/llvmcache-933570AB9628376F0C2EAD9666A92A793D143BE9

what's odd is that it the number is
524291 is 0x80003

I had to dump the llvm output to see the 0xffff_ffff bits.

Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early (non-final) review:

  • Please add riscv64-qemu to builder/builder_test.go and run the test.
  • Please add at least a smoke test for this.
  • Are you sure the compiler matches with the code? Because you're compiling with a LLVM 14 based TinyGo version and the error it gives usually indicates a version mismatch.

@rminnich
Copy link
Author

thanks, that was fast!, will add those things.

@rminnich rminnich force-pushed the riscv64-qemu branch 2 times, most recently from ac55424 to 3ec17b4 Compare March 14, 2023 22:40
tinygo build -target riscv64-qemu -monitor .

many of these:
tinygo:ld.lld: error: /home/rminnich/.cache/tinygo/thinlto/llvmcache-933570AB9628376F0C2EAD9666A92A793D143BE9:\
(function (reflect.Value).Complex: .text.(reflect.Value).Complex+0x76): relocation R_RISCV_HI20 out of range: \
524291 is not in [-524288, 524287]; references reflect$string.170
>>> referenced by value.go:0 (/home/rminnich/tinygo/src/reflect/value.go:0)
>>> defined in /home/rminnich/.cache/tinygo/thinlto/llvmcache-933570AB9628376F0C2EAD9666A92A793D143BE9

what's odd is that it the number is
524291 is 0x80003

I had to dump the llvm output to see the 0xffff_ffff bits.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the status of this PR?

"build-tags": ["virt", "qemu"],
"default-stack-size": 4096,
"linkerscript": "targets/riscv64-qemu.ld",
"emulator": "qemu-system-riscv32 -machine virt -nographic -bios none -kernel {}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qemu-system-riscv32? That doesn't look right.

@@ -0,0 +1,8 @@
{
"inherits": ["riscv64"],
"features": "+a,+c,+m,-relax,-save-restore",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't seem quite right, the test is complaining about it:

    builder_test.go:145: target has LLVM features
        	"+a,+c,+m,-relax,-save-restore"
        but Clang makes it
        	"+64bit,+a,+c,+d,+f,+m,-relax,-save-restore"

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.

3 participants