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

ATOMIC_CAS cann't work on ARM #23

Closed
luokj opened this issue Sep 23, 2017 · 4 comments
Closed

ATOMIC_CAS cann't work on ARM #23

luokj opened this issue Sep 23, 2017 · 4 comments
Assignees

Comments

@luokj
Copy link

luokj commented Sep 23, 2017

Use hash function on ARM platform, but it crash when callinig ht_create

@xant xant self-assigned this Sep 25, 2017
@xant
Copy link
Owner

xant commented Sep 25, 2017

ATOMIC_CAS makes use of __sync_bool_compare_and_swap which I believe it's provided by the compiler also on ARM. Could you provide the exception and the stacktrace (and maybe a coredump) for your crash?

@xant
Copy link
Owner

xant commented Oct 23, 2017

@luokj I think I understand what is your problem.
If it is crashing at runtime with an "Unhandled fault: Alignment Exception",
adding "-mno-unaligned-access" to CFLAGS should fix.
I'll check myself when I'll have access again to a linux ARM system.
Note that maybe on linux you can configure the linux kernel at runtime (/proc/cpu/alignment) to ignore the exception and don't kill the process.

@luokj
Copy link
Author

luokj commented Oct 25, 2017 via email

@xant
Copy link
Owner

xant commented Nov 3, 2017

Ok, packing some structures was overriding the natural alignment and obviously making it not work on ARM unless the "-maligned-access" option was passed to the compiler (but then with obvious performance loss because of unaligned memory access)
I just made packing of those structure optional and controlled by the USE_PACKED_STRUCTURES preprocessor symbol.

Fixed in 172f5a

@xant xant closed this as completed Nov 3, 2017
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

No branches or pull requests

2 participants