[PATCH 2/4] MSP430: Disable exception handling by default for C++
Jozef Lawrynowicz
jozef.l@mittosystems.com
Fri Nov 8 13:26:00 GMT 2019
On Fri, 08 Nov 2019 09:07:39 +0900
Oleg Endo <oleg.endo@t-online.de> wrote:
> On Thu, 2019-11-07 at 21:37 +0000, Jozef Lawrynowicz wrote:
> > The code size bloat added by building C++ programs using libraries containing
> > support for exceptions is significant. When using simple constructs such as
> > static variables, sometimes many kB from the libraries are unnecessarily
> > pulled in.
> >
> > So this patch disable exceptions by default for MSP430 when compiling for C++,
> > by implicitly passing -fno-exceptions unless -fexceptions is passed.
>
> It is extremely annoying when GCC's default standard behavior differs
> across different targets. And as a consequence, you have to add a load
> of workarounds and disable other things, like fiddling with the
> testsuite. It's the same thing as setting "double = float" to get more
> "speed" by default.
>
> I would strongly advice against making such non-standard behaviors the
> default in the vanilla compiler. C++ normally has exceptions enabled.
> If a user doesn't want them and is willing to deal with it all the
> consequences, then we already have a mechanism to do that:
> --fno-exceptions
>
> Perhaps it's generally more useful to add a global configure option for
> GCC to disable exception handling by default. Then you can provide a
> turn-key toolchain to your customers as well -- just add an option to
> the configure line.
>
> Cheers,
> Oleg
>
Fair point, I probably should have realised whilst implementing all the
testsuite workarounds that this wasn't the best choice for upstream GCC and
integrating nicely with the testsuite.
So I've regtested and attached a revised patch to instead build -fno-exceptions
multilibs, so the reduced code size can still be achieved by passing with
-fno-exceptions.
And the --disable-no-exceptions multilib option is added to reduce build time
for developers.
Thanks for providing your input,
Jozef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-MSP430-Add-fno-exceptions-multilib.patch
Type: text/x-patch
Size: 6296 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191108/d48192f8/attachment.bin>
More information about the Gcc-patches
mailing list