Replies: 4 comments 4 replies
-
Hi Dan, Thank you for your detailed report. The intent was to follow the arm build in detail, but if you identified a difference, it is worth further investigating, especially since today I planned to make a new release with 11.3. |
Beta Was this translation helpful? Give feedback.
-
I confirm the issue, with Arm 11.3 and my new xPack pre-release the result is the same as reported. I'll further investigate and let you know when I have a fix. |
Beta Was this translation helpful? Give feedback.
-
It is weird, but I think the problem is solved now. In order to reduce size, the After removing the explicit I'll cleanup the sources, test on all platforms, and provide you a pre-release for tests, hopefully in 1-2 days. |
Beta Was this translation helpful? Give feedback.
-
With the just released 11.3:
|
Beta Was this translation helpful? Give feedback.
-
I'm seeing some large (~4kB) amounts of code linked from libc (lib_a-init.o) into my project that seem to do with exceptions, even though my compilation flags should be disabling exceptions and unwind tables.
I'm using xpack-arm-none-eabi-gcc-11.2.1-1.2 for darwin-arm64.
If I use the ARM official release v11.2 (built for darwin-x86_64), then the binary is much smaller, and the 4kB of unwind/exception code is not linked in.
I made a minimal example that illustrates the issue. You can see the whole project here: https://github.com/danngreen/gcc-11-exception-xpack
main.cc:
Compilation and linking commands:
Compiling with these commands produces a 4kB binary. Output:
The map file reveals that
lib_a-init.o
references symbol__aebi_unwind_cpp_pr0
, and thus the linker includesunwind-arm.o
,libunwind.o
andpr-support.o
. This ends up being a little under 4kB of code added to the .text section.Ive spent a fair amount of time googling around and trying to understand libc and all its options. I did find that if I define the symbol the linker wants to see, then the binary size drops to a reasonable size:
Produces this:
What makes me think this is somehow related to how the xpack version was compiled, is that when I use the official ARM release (v11.2), then I do not need to define
__aeabi_unwind_cpp_pr0
, and I still get a small binary with no libunwind linked in:Additionally, the
abort
andmemcpy
stubs are not needed to link the project when using the official ARM gcc v11.2If I remove the
-fno-unwind-tables -fno-exceptions
flags and compile with the official ARM version, then I get a similar sized binary (~4kB).So it seems like the libc in the official ARM release respects whether I use
-fno-exceptions
or not, but the xpack version forces-fexceptions
to be on.Does anyone have an explanation for this?
Beta Was this translation helpful? Give feedback.
All reactions