<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SimonN's Groups Activities</title><link>https://community.arm.com/members/simonn</link><description>Recent activity for people in SimonN's group</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>C++ Exception Support on Baremetal aarch64-none-elf</title><link>https://community.arm.com/developer/tools-software/oss-platforms/f/gnu-toolchain-forum/48313/c-exception-support-on-baremetal-aarch64-none-elf</link><pubDate>Thu, 17 Dec 2020 17:40:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6244e1d7-d1ff-4a63-9808-a3fca22b0121</guid><dc:creator>SimonN</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m trying to build a baremetal application with C++ exception support with aarch64-none-elf.&lt;/p&gt;
&lt;p&gt;The application is working, but when an exception is thrown, the code doesn&amp;#39;t jump into the catch block.&lt;/p&gt;
&lt;p&gt;It seems that the exception handling is missing, because when throwing an exception, the code stops at &lt;span&gt;&lt;code&gt;uw_update_context()&lt;/code&gt; and is not able to unwind.&lt;/span&gt; &lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When I check the map file, all sections regarding exception handling (&lt;span&gt;&lt;code&gt;eh_frame&lt;/code&gt;, &lt;code&gt;eh_alloc&lt;/code&gt;, &lt;code&gt;eh_catch&lt;/code&gt;&lt;/span&gt; and others) are discarded.&lt;/p&gt;
&lt;p&gt;The commands I use to build and link look like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[ 25%] Building CXX object CMakeFiles/app.dir/main.cpp.obj
/home/someuser/ti/psdk_rtos_auto_j7_07_00_00_11/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf-g++ 
-D[some definitions]
-I[some includes] 
-g 
-MD 
-ffunction-sections 
-fdata-sections 
-c -
mcpu=cortex-a72+fp+simd 
-mabi=lp64 
-mcmodel=large 
-mstrict-align 
-fms-extensions 
-mfix-cortex-a53-835769 
-mfix-cortex-a53-843419
-pedantic 
-fexceptions 
-std=gnu++11 
-o CMakeFiles/app.dir/main.cpp.obj 
-c /home/someuser/app/app/src/lvl1/main.cpp


[100%] Linking CXX executable bin/Debug/app
/home/someuser/ti/psdk_rtos_auto_j7_07_00_00_11/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf-ld
--gc-sections 
-nostartfiles 
--build-id=none 
--entry Entry 
--start-group 
-T /home/someuser/app/app/cmake/toolchain/tda4vm-a72-mpu1_0-baremetal.lds 
-L/home/someuser/ti/psdk_rtos_auto_j7_07_00_00_11/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/lib  
-L/home/someuser/ti/psdk_rtos_auto_j7_07_00_00_11/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/aarch64-none-elf/lib  
-L/home/someuser/ti/psdk_rtos_auto_j7_07_00_00_11/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/lib/gcc/aarch64-none-elf/9.2.1  
/shortenedPath/ti.drv.uart.aa72fg /shortenedPath/ti.osal.aa72fg 
/shortenedPath/ti.csl.init.aa72fg 
/shortenedPath/sciclient.aa72fg 
/shortenedPath/ti.drv.i2c.aa72fg 
/shortenedPath/ti.csl.aa72fg 
/shortenedPath/ti.board.aa72fg  
--start-group CMakeFiles/app.dir/main.cpp.obj --end-group 
--start-group -lstdc++ -lgcc -lm -lc -lrdimon --end-group 
--end-group 
-o bin/Debug/app.xa72fg 
-Map=bin/Debug/app.map&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If I add &lt;code&gt;&lt;span&gt;-fexceptions&lt;/span&gt;&lt;/code&gt; to the link flags, the linker tells me that this can only be used with &lt;code&gt;&lt;span&gt;-shared&lt;/span&gt;&lt;/code&gt; but then I get a lot of errors like &lt;code&gt;&lt;span&gt;dangerous relocation: unsupported relocation&lt;/span&gt;&lt;/code&gt; and &lt;code&gt;&lt;span&gt;relocation ... against symbol `end&amp;#39; which may bind externally can not be used when making a shared object; recompile with -fPIC&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If I add &lt;code&gt;-fPIC&lt;/code&gt; to the compilation, the error is &lt;code&gt;&lt;span&gt;cc1plus: sorry, unimplemented: code model &amp;#39;large&amp;#39; with &amp;#39;-fPIC&amp;#39;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Does this mean that exceptions on baremetal are not supported by this version of GCC?&lt;/p&gt;
&lt;p&gt;How can I get the section for exception handling to not get discarded by the linker?&lt;/p&gt;
&lt;p&gt;What am I missing? I&amp;#39;m thankful for every hint :)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Ask A Question I</title><link>https://community.arm.com/achievements/460ac7df-7ccc-4c42-a204-9e05eef3be09</link><pubDate>Thu, 17 Dec 2020 01:30:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c5eeaa3e-cf53-4ac5-91e4-cb9738f60c81</guid><dc:creator /><description>Ask a question in a forum.</description></item></channel></rss>