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

Consider replacing udis with iced-x86 #36

Closed
LunNova opened this issue Aug 20, 2023 · 8 comments · Fixed by #41
Closed

Consider replacing udis with iced-x86 #36

LunNova opened this issue Aug 20, 2023 · 8 comments · Fixed by #41
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@LunNova
Copy link

LunNova commented Aug 20, 2023

iced-x86 is a pure rust disassembler, udis relies on a c compiler.

If you're ok making this replacement I can try to PR it.

@Hpmason
Copy link
Owner

Hpmason commented Aug 21, 2023

That'd be great! Switching to iced-x86, which is more actively maintained would also avoid issues we've run into like with slice-pool

@vars1ty
Copy link

vars1ty commented Aug 30, 2023

Any updates on this? Just ran into an issue where I can't compile my project at all thanks to libudis86-sys errors.

@polloloco
Copy link

Same here, libudis86-sys wont compile for me when trying to build for the x86_64-pc-windows-msvc target from a linux host (something about memset function not found I believe)

@Hpmason
Copy link
Owner

Hpmason commented Sep 10, 2023

Same here, libudis86-sys wont compile for me when trying to build for the x86_64-pc-windows-msvc target from a linux host (something about memset function not found I believe)

I can't reproduce the issue on my machine, is there any more information you could provide about libudis86-sys failing to compile?

@polloloco
Copy link

Yes of course, this is the error I'm getting

  cargo:warning=clang-16: warning: unknown argument ignored in clang-cl: '-includestring.h' [-Wunknown-argument]
  cargo:warning=libudis86/udis86.c(47,3): error: call to undeclared library function 'memset' with type 'void *(void *, int, unsigned long long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  cargo:warning=  memset((void*)u, 0, sizeof(struct ud));
  cargo:warning=  ^
  cargo:warning=libudis86/udis86.c(47,3): note: include the header <string.h> or explicitly provide a declaration for 'memset'
  cargo:warning=1 error generated.
  exit status: 1

I'm crosscompiling from alpine linux to windows msvc target using clang-cl, pretty much following this guide (I've adapted it to my CI workflow): https://jake-shadle.github.io/xwin/

This issue seems to be the exact same error I'm getting: rust-cross/cargo-xwin#60

Right now my workaround is using this patch by placing this into my Cargo.toml, it works:

[patch.crates-io]
libudis86-sys = { git = 'https://github.com/vars1ty/libudis86-sys.git' }

@Hpmason
Copy link
Owner

Hpmason commented Sep 13, 2023

Ah, I see what's wrong. libudis86-sys uses a flag -includestring.h in the build.rs file. Problem is, clang expects --includestring.h, so it's parsed correctly as an argument. The cc crate probably adds the additional - based on target or host machine, so cross compilation confuses it.

@Hpmason
Copy link
Owner

Hpmason commented Oct 15, 2023

I'm going to start working on this issue. @LunNova If you've already began or plan on working on this let me know, and I'll let you finish it.

@Hpmason Hpmason self-assigned this Oct 15, 2023
@Hpmason Hpmason added the enhancement New feature or request label Oct 15, 2023
@LunNova
Copy link
Author

LunNova commented Oct 19, 2023

I have a branch, I'll push it after work tonight. It may have a safety issue because iced-x86's decoder needs a byte slice for the entire range of instructions you're going to decode, more details will be in the draft PR.

LunNova added a commit to LunNova/retour-rs that referenced this issue Oct 20, 2023
LunNova added a commit to LunNova/retour-rs that referenced this issue Oct 20, 2023
LunNova added a commit to LunNova/retour-rs that referenced this issue Oct 20, 2023
LunNova added a commit to LunNova/retour-rs that referenced this issue Nov 21, 2023
Hpmason pushed a commit that referenced this issue Nov 22, 2023
* replace udis with iced-x86

#36

* Updates for code review
@Hpmason Hpmason linked a pull request Nov 22, 2023 that will close this issue
@Hpmason Hpmason closed this as completed Nov 22, 2023
@Hpmason Hpmason added this to the v0.4.0 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants