Index: ELF/Config.h =================================================================== --- ELF/Config.h +++ ELF/Config.h @@ -65,6 +65,7 @@ bool EhFrameHdr; bool EnableNewDtags; bool ExportDynamic; + bool Fast; bool GcSections; bool GnuHash = false; bool ICF; Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -323,6 +323,7 @@ Config->EhFrameHdr = Args.hasArg(OPT_eh_frame_hdr); Config->EnableNewDtags = !Args.hasArg(OPT_disable_new_dtags); Config->ExportDynamic = Args.hasArg(OPT_export_dynamic); + Config->Fast = Args.hasArg(OPT_fast); Config->GcSections = Args.hasArg(OPT_gc_sections); Config->ICF = Args.hasArg(OPT_icf); Config->NoGnuUnique = Args.hasArg(OPT_no_gnu_unique); Index: ELF/InputFiles.cpp =================================================================== --- ELF/InputFiles.cpp +++ ELF/InputFiles.cpp @@ -143,6 +143,12 @@ template static bool shouldMerge(const typename ELFT::Shdr &Sec) { typedef typename ELFT::uint uintX_t; + + // In fast link mode, we don't merge sections. This makes the linker + // about 2x faster, while it will make it produce larger output. + if (Config->Fast) + return false; + uintX_t Flags = Sec.sh_flags; if (!(Flags & SHF_MERGE)) return false; Index: ELF/Options.td =================================================================== --- ELF/Options.td +++ ELF/Options.td @@ -65,6 +65,9 @@ def export_dynamic_symbol : Separate<["--", "-"], "export-dynamic-symbol">, HelpText<"Put a symbol in the dynamic symbol table">; +def fast: Flag<["--", "-"], "fast">, + HelpText<"Disable slow linker features; may produce larger output">; + def fini : Separate<["-"], "fini">, MetaVarName<"">, HelpText<"Specify a finalizer function">;