I'm trying to build a baremetal application with C++ exception support with aarch64-none-elf.
The application is working, but when an exception is thrown, the code doesn't jump into the catch block.
It seems that the exception handling is missing, because when throwing an exception, the code stops at uw_update_context() and is not able to unwind.
When I check the map file, all sections regarding exception handling (eh_frame, eh_alloc, eh_catch and others) are discarded.
The commands I use to build and link look like this:
[ 25%] Building CXX object CMakeFiles/app.dir/main.cpp.obj
[100%] Linking CXX executable bin/Debug/app
--start-group CMakeFiles/app.dir/main.cpp.obj --end-group
--start-group -lstdc++ -lgcc -lm -lc -lrdimon --end-group
If I add -fexceptions to the link flags, the linker tells me that this can only be used with -shared but then I get a lot of errors like dangerous relocation: unsupported relocation and relocation ... against symbol `end' which may bind externally can not be used when making a shared object; recompile with -fPIC.
dangerous relocation: unsupported relocation
relocation ... against symbol `end' which may bind externally can not be used when making a shared object; recompile with -fPIC
If I add -fPIC to the compilation, the error is cc1plus: sorry, unimplemented: code model 'large' with '-fPIC'
cc1plus: sorry, unimplemented: code model 'large' with '-fPIC'
Does this mean that exceptions on baremetal are not supported by this version of GCC?
How can I get the section for exception handling to not get discarded by the linker?
What am I missing? I'm thankful for every hint :)
Thanks in advance,
Any hints are helpfull :)
Any suggestions here ? we are also facing similar issue.
I'm trying to build an application with exception support on A72 with aarch64-none-elf. Does this mean that exceptions on bare-metal are not supported by It's a C++ application, not C? So I'm not sure if this is comparable.
View all questions in GNU Toolchain forum