Components that use Image_RO_Base
Components that use own veneers to enter C
Addressing the end-of-life of AArch32
Currently int and long are 32-bits, long long is 64-bits (ILP32LL).
It is proposed that long becomes 64-bits (LP64).
Never cast a pointer to int or long, cast to intptr_t or uintptr_t instead.
To print a pointer, use %p. The specifier %x will truncate.
wrong: printf(“Block at &%x\n”, block); /* Address truncated */
right: printf(“Block at &%p\n”, block);
Entries in a filesystem information block are 32-bits wide, but you still musn’t truncate too soon:
wrong: (int)entry – (int)Image_RO_Base /* Both addresses truncated */
right: (int32_t) ((uintptr_t)entry – Image_RO_Base)
The first one won’t work if the module is loaded at 4GB or above. (Does it matter if it is uintptr_t or intptr_t??) In practice the first one will probably work ok since it’s unlikely a module image will be loaded so as to straddle a 4GB boundary; but removing these casts makes it easier to check the source code.
If an array of chars is 2GB long or greater, you won’t be able to index it using int. Use size_t instead.