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

Enable -ffreestanding by default #5429

Open
nfeske opened this issue Jan 21, 2025 · 1 comment
Open

Enable -ffreestanding by default #5429

nfeske opened this issue Jan 21, 2025 · 1 comment

Comments

@nfeske
Copy link
Member

nfeske commented Jan 21, 2025

In the context of issue #5428, I encountered the following compile error when including the arm_neon.h header:

.../lib/gcc/aarch64-none-elf/12.3.0/include/stdint.h:9:26: error: no include path in which to search for stdint.h
    9 | # include_next <stdint.h>

The included stdint.h contains the following distinction:

#ifndef _GCC_WRAP_STDINT_H
#if __STDC_HOSTED__
# if defined __cplusplus && __cplusplus >= 201103L
#  undef __STDC_LIMIT_MACROS
#  define __STDC_LIMIT_MACROS
#  undef __STDC_CONSTANT_MACROS
#  define __STDC_CONSTANT_MACROS
# endif
# include_next <stdint.h>
#else
# include "stdint-gcc.h"
#endif
#define _GCC_WRAP_STDINT_H
#endif

__STDC_HOSTED__ is enabled by default. Hence, the code expects the presence of stdint.h supplied by a libc.
Only if the compiler was invoked with the argument -ffreestanding, this assumption does not apply.

Consequently, whenever including arm_neon.h for a native Genode component not using the libc, we would need to extend the component's target.mk with the following tweak for the corresponding compilation unit (e.g., main.cc):

CC_OPT_main += -ffreestanding

It goes without saying that this approach becomes impractical as soon as we embrace SIMD at more and more places.

Therefore, I propose to enable -ffreestanding by default, with the option to discharge the default for a given target.

In particular, all components using the libc won't use -ffreestanding.

@nfeske nfeske added the cleanup label Jan 21, 2025
nfeske added a commit that referenced this issue Jan 21, 2025
@nfeske
Copy link
Member Author

nfeske commented Jan 21, 2025

Changed by b455139

@nfeske nfeske added the fixed label Jan 21, 2025
nfeske added a commit to nfeske/genode that referenced this issue Jan 21, 2025
nfeske added a commit to nfeske/genode that referenced this issue Jan 23, 2025
cnuke pushed a commit to cnuke/genode that referenced this issue Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant