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

Assembly seems to be broken on riscv #2452

Open
TethysSvensson opened this issue Sep 5, 2024 · 4 comments · May be fixed by #2419
Open

Assembly seems to be broken on riscv #2452

TethysSvensson opened this issue Sep 5, 2024 · 4 comments · May be fixed by #2419

Comments

@TethysSvensson
Copy link
Contributor

I've tried using the asm tool for riscv32 and riscv64 and it doesn't seem to work correctly.

Example:

$ asm -c riscv32 'nop'
[!] Could not find system include headers for riscv32-linux
0100
$ asm -c riscv32 'addi x0, x0, 0'
[!] Could not find system include headers for riscv32-linux
0100
$ asm -c riscv32 'addi x0, x0, 1'
[!] Could not find system include headers for riscv32-linux
13001000
$ asm -c riscv64 'nop'
[!] Could not find system include headers for riscv64-linux
0100
$ asm -c riscv64 'addi x0, x0, 0'
[!] Could not find system include headers for riscv64-linux
0100
$ asm -c riscv64 'addi x0, x0, 1'
[!] Could not find system include headers for riscv64-linux
13001000

Instructions in riscv cannot be only two bytes long.

@Arusekk
Copy link
Member

Arusekk commented Sep 5, 2024

See #2419

@Arusekk Arusekk linked a pull request Sep 5, 2024 that will close this issue
@TethysSvensson
Copy link
Contributor Author

My bad, it seems like I don't know riscv very well at all.

Still, I don't think asm produce assembly that only works on processors with the C extension, unless explicitly enabled.

@Xeonacid
Copy link
Contributor

Still, I don't think asm produce assembly that only works on processors with the C extension, unless explicitly enabled.

All existing riscv64 chips designed to run Linux have the C extension, and main Linux distributions (Debian, Ubuntu, Fedora, Arch Linux...) all use rv64gc as their baseline. I think including the C extension by default is reasonable.

@TethysSvensson
Copy link
Contributor Author

As far as I remember, I was not targeting a Linux system at the time.

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

Successfully merging a pull request may close this issue.

3 participants