Hi Jérôme,
On 15/05/18 11:53, Jérôme Lambourg wrote:
Hello gcc-patch list,
While trying to build a x86_64-linux hosted cross arm bare metal compiler with
both --with-multilib-list=rmprofile and --without-headers, the libgcc build
fails while trying to build the armv8-m variant with the following message:
In file included from .../build/gcc/include/arm_cmse.h:38,
from .../gcc/libgcc/config/arm/cmse.c:27:
.../build/gcc/include/stdint.h:9:16: fatal error: stdint.h: No such file or
directory
# include_next <stdint.h>
^~~~~~~~~~
Attached is a patch that removes the dependency over stdint.h (to respect
--without-headers) and replaces uintptr_t and UINTPTR_MAX in cmse.c with their
equivalent gcc predefined macros, respectively __UINTPTR_TYPE__ and
__UINTPTR_MAX__.
For the record, I configured gcc (r260250) with the following command:
../gcc/configure --enable-languages=c --with-gnu-as --with-gnu-ld \
--with-multilib-list=rmprofile --disable-nls --without-libiconv-prefix \
--enable-multilib --target=arm-eabi --without-headers
Unfortunately, I don't have an armv8-m testing environment, so could only check
that the libgcc now builds fine. But the patch is small and simple enough that
I'm confident the generated code is equivalent to the original intent.
Thanks for the patch! To validate it your changes you can also look at the
disassembly
of the cmse.c binary in the build tree. If the binary changes with your patch
then that
would indicate some trouble. I've got another comment below.
2018-05-15 Jerome Lambourg <lambo...@adacore.com>
gcc/
* config/arm/arm_cmse.h: Remove #include <stdint.h>
libgcc/
* config/arm/cmse.c (cmse_check_address_range): Replace
UINTPTR_MAX with __UINTPTR_MAX__ and uintptr_t with __UINTPTR_TYPE__.
Index: gcc/config/arm/arm_cmse.h
===================================================================
--- gcc/config/arm/arm_cmse.h (revision 260250)
+++ gcc/config/arm/arm_cmse.h (working copy)
@@ -35,7 +35,6 @@
#if __ARM_FEATURE_CMSE & 1
#include <stddef.h>
-#include <stdint.h>
There are places in arm_cmse.h that use intptr_t. You should replace those as
well.
Look for the cmse_nsfptr_create and cmse_is_nsfptr macros...
Thanks,
Kyrill