]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
Fix size for long types on aarch64
authorMaria Sfiraiala <maria.sfiraiala@gmail.com>
Wed, 3 Aug 2022 15:53:05 +0000 (18:53 +0300)
committerUnikraft <monkey@unikraft.io>
Wed, 16 Nov 2022 17:23:52 +0000 (17:23 +0000)
Default size of the data model for AArch64 is 8 (64 bits) for long
types, however newlibc ends up defining LONG_MAX as 32 bits.

This issue causes extremely optimized functions, such as memchr (which
parses DTB for apps like SQLite or redis), to crash when compiled for
AArch64.

This commit redefines the size for long types as 64 bits on AArch64.

Signed-off-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Approved-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #21

include/limits.h

index cbe57fa922837edcf629be72e3482ec4a2d799db..d654a1d29a48146c8f434ddec17bfdcf30a7394b 100644 (file)
@@ -51,7 +51,7 @@
 #define SHRT_MAX        0x7fff
 #define USHRT_MAX       0xffff
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__ARM_64__)
 # define LONG_MAX       0x7fffffffffffffffL
 # define ULONG_MAX      0xffffffffffffffffUL
 #else