rust/compiler/rustc_interface/src
Javier Blazquez 4ed846ad4d Add -Z no-unique-section-names to reduce ELF header bloat.
This change adds a new compiler flag that can help reduce the size of
ELF binaries that contain many functions.

By default, when enabling function sections (which is the default for most
targets), the LLVM backend will generate different section names for each
function. For example, a function "func" would generate a section called
".text.func". Normally this is fine because the linker will merge all those
sections into a single one in the binary. However, starting with LLVM 12
(llvm/llvm-project@ee5d1a0), the backend will
also generate unique section names for exception handling, resulting in
thousands of ".gcc_except_table.*" sections ending up in the final binary
because some linkers don't currently merge or strip these EH sections.
This can bloat the ELF headers and string table significantly in
binaries that contain many functions.

The new option is analogous to Clang's -fno-unique-section-names, and
instructs LLVM to generate the same ".text" and ".gcc_except_table"
section for each function, resulting in smaller object files and
potentially a smaller final binary.
2021-10-11 12:09:32 -07:00
..
callbacks.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
interface.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
lib.rs Simplify scoped_thread 2021-09-23 12:56:59 -04:00
passes.rs Auto merge of #89266 - cjgillot:session-ich, r=michaelwoerister 2021-10-05 09:45:11 +00:00
proc_macro_decls.rs Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
queries.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
tests.rs Add -Z no-unique-section-names to reduce ELF header bloat. 2021-10-11 12:09:32 -07:00
util.rs Fix clippy lints 2021-10-01 23:17:19 +02:00