-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
C++ exceptions do not work when building with GNU Arm Embedded #35972
Comments
Analysis When building with Zephyr SDK:
When building with GNU Arm Embedded:
The Lines 28 to 29 in 21d1ad3
This happens only with the GNU Arm Embedded toolchain because it is built with the libgcc transactional memory support is disabled and therefore Note that the zephyr/include/arch/arm/aarch32/cortex_m/scripts/linker.ld Lines 324 to 326 in 9143f4f
zephyr/include/linker/cplusplus-ram.ld Lines 19 to 29 in 9143f4f
When |
The `.eh_frame_hdr` and `.eh_frame` ROM sections, which contain read- only C++ exception handling information, are currently specified in `cplusplus-ram.ld`, and this can cause the linker output location counter to take a ROM region address while in the RAM region. This commit relocates these sections to `cplusplus-rom.ld` in order to prevent the linker output location counter from getting corrupted. For more details, refer to the issue zephyrproject-rtos#35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
UPDATE: C++ exception handling now works on all 32-bit ARM platforms when building with GNU Arm Embedded after #35982, given that It fails as follows when
This might be a newlib/libstdc++ nano build-time configuration-related issue, especially noting that there seems to be a big difference in terms of the compiled binary size between the Zephyr SDK and the GNU Arm Embedded toolchains: Zephyr SDK (
GNU Arm Embedded (
|
NOTE: Comparing Zephyr SDK and GNU Arm Embedded libraries Zephyr SDK
GNU Arm Embedded
Note the size difference between
There is no discernible difference between the Zephyr SDK and the GNU Arm Embedded when it comes to newlib ( TODO: Investigate the build options for the standard C++ library and find out what differences there are. p.s. It looks like Zephyr SDK is not properly building the nano version of @galak FYI |
So, as far as GNU Arm Embedded is concerned, the nano variant of libstdc++ nano is not supposed to support C++ exceptions. From GNU Arm Embedded build script:
Note that This is, in fact, a sensible decision made by the GNU Arm Embedded architects, given that enabling C++ exception handling support significantly increases the binary size. In the light of this, the following changes need to be implemented:
|
This commit makes C++ exception handling feature depend on the full version of newlib (i.e. `CONFIG_NEWLIB_LIBC_NANO=n`). The `nano.specs`, which selects the nano variant of newlib, libstdc++, and libsupc++, does not support C++ exception handling because its lib*c++ is compiled with `-fno-exceptions`. For more details, refer to the issue zephyrproject-rtos#35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The `.eh_frame_hdr` and `.eh_frame` ROM sections, which contain read- only C++ exception handling information, are currently specified in `cplusplus-ram.ld`, and this can cause the linker output location counter to take a ROM region address while in the RAM region. This commit relocates these sections to `cplusplus-rom.ld` in order to prevent the linker output location counter from getting corrupted. For more details, refer to the issue #35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit makes C++ exception handling feature depend on the full version of newlib (i.e. `CONFIG_NEWLIB_LIBC_NANO=n`). The `nano.specs`, which selects the nano variant of newlib, libstdc++, and libsupc++, does not support C++ exception handling because its lib*c++ is compiled with `-fno-exceptions`. For more details, refer to the issue #35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The `.eh_frame_hdr` and `.eh_frame` ROM sections, which contain read- only C++ exception handling information, are currently specified in `cplusplus-ram.ld`, and this can cause the linker output location counter to take a ROM region address while in the RAM region. This commit relocates these sections to `cplusplus-rom.ld` in order to prevent the linker output location counter from getting corrupted. For more details, refer to the issue #35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit makes C++ exception handling feature depend on the full version of newlib (i.e. `CONFIG_NEWLIB_LIBC_NANO=n`). The `nano.specs`, which selects the nano variant of newlib, libstdc++, and libsupc++, does not support C++ exception handling because its lib*c++ is compiled with `-fno-exceptions`. For more details, refer to the issue #35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The `.eh_frame_hdr` and `.eh_frame` ROM sections, which contain read- only C++ exception handling information, are currently specified in `cplusplus-ram.ld`, and this can cause the linker output location counter to take a ROM region address while in the RAM region. This commit relocates these sections to `cplusplus-rom.ld` in order to prevent the linker output location counter from getting corrupted. For more details, refer to the issue #35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit makes C++ exception handling feature depend on the full version of newlib (i.e. `CONFIG_NEWLIB_LIBC_NANO=n`). The `nano.specs`, which selects the nano variant of newlib, libstdc++, and libsupc++, does not support C++ exception handling because its lib*c++ is compiled with `-fno-exceptions`. For more details, refer to the issue #35972. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Describe the bug
C++ exceptions do not work when building for ARM platforms using GNU Arm Embedded toolchain.
To Reproduce
Build and run
tests/subsys/cpp/libcxx
withCONFIG_EXCEPTIONS=y
for any ARM board (e.g.mps2_an521
).Logs and console output
For
qemu_cortex_r5
:For the rest of the emulated ARM platforms, including
qemu_cortex_m3
andmps2_an521
, it just hangs during boot and nothing is output on console.Environment (please complete the following information):
Additional context
Note that this problem is specific to the GNU Arm Embedded toolchain. C++ exceptions work when building with Zephyr SDK (0.12.4).
The text was updated successfully, but these errors were encountered: