Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
amelioration:taille:c [2017/06/30 21:53] – [Méthode automatique] : ajout de "-fno-enforce-eh-specs" root | amelioration:taille:c [2017/09/10 12:35] (Version actuelle) – déplacement pdf root |
---|
| |
=====Méthode automatique===== | =====Méthode automatique===== |
Options de GCC : | Options de GCC ([[https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc.pdf|Using the GNU Compiler Collection]] {{ :prog:gcc:gcc-7.2.0.pdf |Archive}}) : |
| |
''-ffunction-sections -fdata-sections'' même si la documentation semble dire l'inverse. | ''-ffunction-sections -fdata-sections'' même si la documentation semble dire l'inverse. |
g++ -ffunction-sections -fdata-sections -c -o example.o example.cpp | g++ -ffunction-sections -fdata-sections -c -o example.o example.cpp |
<blockquote> When you specify these options, the assembler and linker create larger object and executable files and are also slower.<cite>[[https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Optimize-Options.html|Source]], {{ :amelioration:taille:c:optimize_options_-_using_the_gnu_compiler_collection_gcc_.html.maff |Archive}}</cite></blockquote> | <blockquote> When you specify these options, the assembler and linker create larger object and executable files and are also slower.</blockquote> |
| |
''-fno-enforce-eh-specs'' | ''-fno-enforce-eh-specs'' |
| |
<blockquote>Don’t generate code to check for violation of exception specifications at run time. This option violates the C++ standard, but may be useful for reducing code size in production builds, much like defining NDEBUG. This does not give user code permission to throw exceptions in violation of the exception specifications; the compiler still optimizes based on the specifications, so throwing an unexpected exception results in undefined behavior at run time. | <blockquote>Don’t generate code to check for violation of exception specifications at run time. This option violates the C++ standard, but may be useful for reducing code size in production builds, much like defining NDEBUG. This does not give user code permission to throw exceptions in violation of the exception specifications; the compiler still optimizes based on the specifications, so throwing an unexpected exception results in undefined behavior at run time.</blockquote> |
<cite>[[https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html|Source]], {{ :amelioration:taille:c:using_the_gnu_compiler_collection_gcc_c_dialect_options.html.maff |Archive}}</cite></blockquote> | |
| |
Option pour le lieur : ''-Wl,--gc-sections'' | Option pour le lieur : ''-Wl,%%--%%gc-sections'' ([[https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gnat_ugn.pdf|GNAT User’s Guide for Native Platforms]], {{ :prog:gnat:gnat_ugn-7.2.0.pdf |Archive}}) |
g++ -Wl,--gc-sections example_cpp example.o | g++ -Wl,--gc-sections example_cpp example.o |
| |