Index: tools/gold/gold-plugin.cpp =================================================================== --- tools/gold/gold-plugin.cpp +++ tools/gold/gold-plugin.cpp @@ -203,6 +203,8 @@ static std::string dwo_dir; /// Statistics output filename. static std::string stats_file; + // Disable section ordering. + static bool disable_section_ordering; // Optimization remarks filename and hotness options static std::string OptRemarksFilename; @@ -278,6 +280,8 @@ OptRemarksWithHotness = true; } else if (opt.startswith("stats-file=")) { stats_file = opt.substr(strlen("stats-file=")); + } else if (opt == "disable-section-ordering") { + disable_section_ordering = true; } else { // Save this option to pass to the code generator. // ParseCommandLineOptions() expects argv[0] to be program name. Lazily @@ -834,9 +838,8 @@ // FIXME: Check the gold version or add a new option to enable them. Conf.Options.RelaxELFRelocations = false; - // Enable function/data sections by default. - Conf.Options.FunctionSections = true; - Conf.Options.DataSections = true; + Conf.Options.FunctionSections = !options::disable_section_ordering; + Conf.Options.DataSections = !options::disable_section_ordering; Conf.MAttrs = MAttrs; Conf.RelocModel = RelocationModel;