C++ Logo

sg14

Advanced search

Re: [SG14] compiler flag sanity check for error handling research

From: Clément Grégoire <clem.gregoire.cg_at_[hidden]>
Date: Mon, 4 Feb 2019 09:58:54 +0100
Hi,
I didn't really see anything missing in the options you used.
As you mentioned, you are linking statically as much as you can, and thus
pull in the stdlib and CRT which is the issue here I think.

I'd suggest giving https://github.com/aras-p/sizer a try on windows, and
https://github.com/google/bloaty for Linux.

Your results with only main are a bit weird, as last I checked on windows
(with the dll CRT, not static) my executable was only a few kilobytes, but
I wouldn't be that surprised if linking the runtimes statically have such
an impact on size.
There are a lot of static machinery for example because of locale that can
not always be stripped by linkers.



Le lun. 4 févr. 2019 à 05:38, Matthew Bentley <mattreecebentley_at_[hidden]>
a écrit :

> Generally I have seen MSVC exes tend to be smaller, I assumed that's
> because they're calling in system dlls for a lot of the work as
> opposed to compiling it into the exe, but don't really know enough to
> comment.
>
> On 04/02/2019, Ben Craig <ben.craig_at_[hidden]> wrote:
> > I can do -march native.
> >
> > None of the files include iostreams. I don't include much in the way of
> > C/C++ standard library headers. I use limits.h a lot. The cases that
> call
> > abort() pull in stdlib.h. I'm using Simon Brand's <expected.hpp> header,
> > and that pulls in exception, functional, type_traits, and utility. I
> pull
> > in exception when I'm deriving from std::exception in that one batch of
> > tests.
> >
> >> -----Original Message-----
> >> From: SG14 <sg14-bounces_at_[hidden]> On Behalf Of Matthew Bentley
> >> Sent: Sunday, February 3, 2019 8:29 PM
> >> To: Low Latency:Game Dev/Financial/Trading/Simulation/Embedded Devices
> >> <sg14_at_[hidden]>
> >> Subject: Re: [SG14] compiler flag sanity check for error handling
> >> research
> >>
> >> Without reading every src file I can't comment much, but iostream bloats
> >> binaries under GCC, I know that much.
> >> -march=native might be useful as a comparison for GCC.
> >> _______________________________________________
> >> SG14 mailing list
> >> SG14_at_[hidden]
> >> https://urldefense.proofpoint.com/v2/url?u=http-
> >> 3A__lists.isocpp.org_mailman_listinfo.cgi_sg14&d=DwICAg&c=I_0YwoKy7z5L
> >> MTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-
> >> UCZRX0Vl1g&m=02GI0L6sGnhgI1Iu15qaPqb9pUef5lnsyw7ldHcW7SQ&s=cAN
> >> 4Te5Z5miXkt1XYQmUC2EcIzu6OsLZoM0YUgK9KoA&e=
> > _______________________________________________
> > SG14 mailing list
> > SG14_at_[hidden]
> > http://lists.isocpp.org/mailman/listinfo.cgi/sg14
> >
> _______________________________________________
> SG14 mailing list
> SG14_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/sg14
>

Received on 2019-02-04 03:00:26