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

add loongarch64 arch support #4

Merged
merged 16 commits into from
Aug 10, 2024
Merged

Conversation

Godones
Copy link
Contributor

@Godones Godones commented Aug 7, 2024

No description provided.

@Evian-Zhang
Copy link
Owner

Thank you for your contribution! I wonder why the jump entries are designed to use absolute address instead of relative address? Does Loongarch Linux not support ASLR?

@Godones
Copy link
Contributor Author

Godones commented Aug 7, 2024

Loongarch Linux supports ASLR. When I use relative addresses in Rust's inline assembly, I find that the values ​​in jump entry are all 0, so I use absolute addresses instead.

@Evian-Zhang
Copy link
Owner

It's strange. Maybe an LLVM bug?

Anyway, using absolute addresses here is not suitable for applications with ASLR enabled, since those addresses may be relocated somewhere else at run time.

@Godones
Copy link
Contributor Author

Godones commented Aug 7, 2024

Maybe I can ask someone at loongarch.

@Godones
Copy link
Contributor Author

Godones commented Aug 7, 2024

The cross-rs tool currently uses the gnu toolchain for linking, but the version of binutils is low and does not support the relocation of R_LARCH_64_PCREL, so error occurs in calculating relative addresses. I can change the code to calculate relative addresses, but that might not pass the cross test.

@Evian-Zhang
Copy link
Owner

Is there any tracking issue for this problem at Rust main repository or cross-rs repo or anywhere else? I could track it and merge the PR after corresponding issue is solved.

@Godones
Copy link
Contributor Author

Godones commented Aug 7, 2024

Maybe this cross-rs/cross#973

@heiher
Copy link

heiher commented Aug 8, 2024

Thanks for your contribution to LoongArch. This is the tracking issue for this: cross-rs/cross#1538

@Evian-Zhang
Copy link
Owner

It seems that the cross-rs has updated the binutils toolchain. Would you update your code for relative addresses? :)

@Evian-Zhang Evian-Zhang merged commit 8f5a684 into Evian-Zhang:master Aug 10, 2024
12 checks passed
@Evian-Zhang
Copy link
Owner

Thank you :)

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