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

(Do not submit) - draft for adapting to capstone arm64 renaming #671

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bjacob
Copy link
Contributor

@bjacob bjacob commented Nov 24, 2023

FYI @wolfpld: Capstone has just done a breaking renaming: ARM64 --> AArch64 (capstone-engine/capstone#2026)

This PR is a good-enough local patch for anyone trying to build against latest Capstone. It uses Capstone's own provided compatibility macros to resolve to either the old or the new identifiers.

The problem which IIUC makes this PR not good to merge is that by relying on these Capstone macros... it probably doesn't actually support older Capstone versions, which presumably don't have these macros.

You probably need to resolve that by forking these macros on the Tracy side...

@Rot127
Copy link

Rot127 commented Jan 16, 2024

@bjacob Just stumbled on this. Capstone v5 and v4 have those macros now. See capstone.h in each branch.

@hanhanW
Copy link

hanhanW commented Jan 22, 2024

oooh! I also hit the same issue! It seems that I should maybe just build capstone v5, but not next? Let me give it a shot..

@hanhanW
Copy link

hanhanW commented Jan 22, 2024

v5 works for me, I will use v5 for now

@Rot127
Copy link

Rot127 commented Jan 22, 2024

@hanhanW Mind that v5 is pretty out of date already. It is based on LLVM 7, misses some Aarch64 extensions and has some bugs. We have a guide regarding the upcoming v6 if you want to take a look.

@hanhanW
Copy link

hanhanW commented Jan 22, 2024

@hanhanW Mind that v5 is pretty out of date already. It is based on LLVM 7, misses some Aarch64 extensions and has some bugs. We have a guide regarding the upcoming v6 if you want to take a look.

I'm good with v5 for now because I don't need to jump into asm level at this moment. I mainly wanted to address compilation issues when building tracy with IREE. Thanks for the heads-up!

@bjacob
Copy link
Contributor Author

bjacob commented Mar 14, 2024

@wolfpld, it seems that multiple people have hit this. Would you suggest merging some flavor of this (do you want to suggest changes to this draft) ?

@bjacob
Copy link
Contributor Author

bjacob commented Mar 14, 2024

@bjacob Just stumbled on this. Capstone v5 and v4 have those macros now. See capstone.h in each branch.

I'm not sure that we can count on all users' package managers to have received the backport.

@bjacob
Copy link
Contributor Author

bjacob commented Mar 14, 2024

The guaranteed thing that we can do here is, as suggested in the PR description, fork those CS compatibility macros on the Tracy side.

@wolfpld
Copy link
Owner

wolfpld commented Mar 14, 2024

#707 should solve this.

@bjacob
Copy link
Contributor Author

bjacob commented Mar 14, 2024

#707 should solve this.

From a cursory look --- it looks like this hardcodes Capstone 5.0.1 ? I actually need to use Capstone 6 to use recent ISA extensions. Doing so would require Tracy-side source changes as in the present PR, right ?

@bjacob
Copy link
Contributor Author

bjacob commented Mar 14, 2024

Looks like a good step though, from where the capstone 5->6 move could be made as a second step ? Given the headache that capstone has been giving tracy users, I definitely welcome Tracy internalizing it.

@wolfpld
Copy link
Owner

wolfpld commented Mar 14, 2024

The key thing is that it hardcodes a version, so you have one target, instead of the crapshoot that is currently the case (the 💩 prize goes to ubububu, which ships 3.x 🤯).

@bjacob
Copy link
Contributor Author

bjacob commented Mar 14, 2024

Yup, exactly. Once #707 is merged, and we've rebased our downstream to work with that, i'll rebase the present PR into a capstone 5->6 bump (which you may or may not merge, but it's useful for me even if unmerged).

@wolfpld
Copy link
Owner

wolfpld commented Mar 24, 2024

FYI, CMake has been "merged".

@ScottTodd
Copy link

Yup, exactly. Once #707 is merged, and we've rebased our downstream to work with that, i'll rebase the present PR into a capstone 5->6 bump (which you may or may not merge, but it's useful for me even if unmerged).

I'm currently updating our (IREE's) downstream to use the CMake files now present here in Tracy upstream (we'll just use the upstream build and drop our custom CMake + custom instructions, unless there is some reason to keep them that I'm not seeing). @bjacob did you want to continue with a capstone 5 -> 6 update?

@bjacob
Copy link
Contributor Author

bjacob commented May 23, 2024

Yup, that's the plan laid out at iree-org/iree#16777. The above #671 (comment) implies that the first step in the tasklist there is already completed, and what you describe doing is the second step in that tasklist, so after that we can bump from Capstone 5 to 6, the third step in that tasklist (the tasklist is framed in a way that assumes that the capstone 5->6 bump would be merged in upstream tracy (here) first, but if that's not desired here, we can keep that as a local tracy patch).

@ScottTodd
Copy link

I'm not sure why those steps are dependent on one another?

@bjacob
Copy link
Contributor Author

bjacob commented May 23, 2024

not a strict dependence at every step, just my suggestion how in what order to tackle things.

@Rot127
Copy link

Rot127 commented May 24, 2024

I am sorry, forgot to drop it here. But we have a compatibility header now. Though, it is still a PR until the other maintainers manage to look at it: capstone-engine/capstone#2321

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.

None yet

5 participants