Skip to content

Conversation

kzall0c
Copy link
Contributor

@kzall0c kzall0c commented Sep 7, 2025

The hashmap implementation currently defines ARCH64 only for amd64 and aarch64, and now also checks for 64-bit RISC-V by checking __riscv with __riscv_xlen == 64.

This enables uftrace to correctly detect 64-bit RISC-V user programs and apply the appropriate word size.

utils/hashmap.h Outdated
#include <stdlib.h>

#if defined(__amd64__) || defined(__aarch64__)
#if defined(__amd64__) || defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64)
Copy link
Owner

Choose a reason for hiding this comment

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

Can we have more general check like below?

#if __SIZEOF_POINTER__ == 8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you Namhyung, for the review! How about this?
#if __SIZEOF_POINTER__ >= 8

The hashmap implementation currently defines ARCH64 only for
amd64 and aarch64, and now also checks for 64-bit RISC-V by
checking __SIZEOF_POINTER__.

This enables uftrace to correctly detect 64-bit RISC-V user
programs and apply the appropriate word size.

Signed-off-by: Yunseong Kim <[email protected]>
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants