Skip to content

Commit

Permalink
ccan: don't attempt unaligned access on arm
Browse files Browse the repository at this point in the history
  • Loading branch information
jgriffiths committed May 20, 2023
1 parent ec67b98 commit 745bc55
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ccan_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
#define HAVE_BSWAP_64 0
#endif

#if defined(HAVE_UNALIGNED_ACCESS) && defined(__arm__)
/* arm unaligned access is incomplete, in that e.g. byte swap instructions
* can fault on unaligned addresses where a normal load/store would be fine.
* Since the compiler can optimise some of our accesses into operations like
* byte swaps, treat this platform as though it doesn't have unaligned access.
*/
#undef HAVE_UNALIGNED_ACCESS
#define HAVE_UNALIGNED_ACCESS 0
#endif

#if HAVE_UNALIGNED_ACCESS
#define alignment_ok(p, n) 1
#else
Expand Down

0 comments on commit 745bc55

Please sign in to comment.