-
Notifications
You must be signed in to change notification settings - Fork 7k
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
cmake: c++ exceptions linking support #35647
cmake: c++ exceptions linking support #35647
Conversation
6292658
to
a8e5874
Compare
Could you refactor the linker script addition into a file, so it can be done via #include? |
a8e5874
to
4b2d0cd
Compare
Done, placed it in cplusplus-ram.ld where we already have linker code related to exception tables. |
4b2d0cd
to
e2501fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This claims to fix #32448, but there are some platforms that still fail.
Just noting that #32448 should stay open to keep track of them ... (see #32448 (comment)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following should be updated to test the platforms that work after the changes in this PR:
zephyr/tests/subsys/cpp/libcxx/testcase.yaml
Lines 11 to 19 in 7b7ed2b
cpp.libcxx.exceptions: | |
# FIXME: change when issue is resolved #32448 | |
platform_allow: mps2_an385 | |
toolchain_exclude: xcc | |
min_flash: 54 | |
tags: cpp | |
timeout: 5 | |
extra_configs: | |
- CONFIG_EXCEPTIONS=y |
Looking into this, the
also some archs passes on
but fails when using twister:
other archs (riscv32) fails on tests/subsys/cpp/libcxx but not CPP_TEST. Marked |
# are linked at specific locations. | ||
# The location is so important that we cannot let this be controlled by normal | ||
# link libraries, instead we must control the link command specifically as | ||
# part of toolchain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW: trying to do this on the command line is fragile. Really this needs to happen in a linker script. Also I wouldn't be surprised if the rules are platform-dependent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For GCC this has normally be done via a spec file. @andyross Have you seen anywhere that this is done via linker script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how will you tell the linker which objects (crtbegin.o and crtend.o) to link in a linker file ?
Not to mention that the position of those objects on the linker invocation is important.
This is why this is to be considered a toolchain (linker) setting.
e2501fd
to
8d096ec
Compare
Updated description text with list of platform that are fixed with this PR, as it stands. The following platforms still fails: |
Fixes part of: zephyrproject-rtos#32448 This commit updates the CMake CMAKE_CXX_LINK_EXECUTABLE to include crtbegin.o and crtend.o at the right locations when linking with gcc. It also updates linker scripts to ensure proper location of the exception header frame sections. This ensure proper handling of exceptions for those architectures - x86 - xtensa - riscv32 Signed-off-by: Kumar Gala <kumar.gala@linaro.org> Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Increasing ZTEST_STACKSIZE to 4096. This ensures that the riscv32 platforms can succesfully execute the C++ exception test cases. Also add the following platforms to allow list: - qemu_arc_em - qemu_arc_hs - qemu_cortex_m0 - qemu_cortex_m3 - qemu_cortex_r5 - qemu_riscv32 - qemu_x86 - qemu_xtensa Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
8d096ec
to
33818f0
Compare
Done. |
Fixes part of: #32448
This commit updates the CMake CMAKE_CXX_LINK_EXECUTABLE to include
crtbegin.o and crtend.o at the right locations when linking with gcc.
It also updates linker scripts to ensure proper location of the
exception header frame sections.
Signed-off-by: Kumar Gala kumar.gala@linaro.org
Signed-off-by: Torsten Rasmussen Torsten.Rasmussen@nordicsemi.no
Update:
The following platforms are fixed with this PR:
qemu_x86
qemu_riscv32
qemu_xtensa
The following platforms still fails:
qemu_x86_64 (fails with
exit
)qemu_cortex_a53 (fails with
exit
)qemu_riscv64 (fails with
exit
)qemu_nios2 (hangs)
qemu_leon3 (fails with trap_instruction)