diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-02-20 18:08:57 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-02-20 18:08:57 +0000 |
| commit | 6b07a1c6ee50dcf4d52a4a314b4774347f9b22c0 (patch) | |
| tree | 4cc8c21d84f5ad56ef4c8addf953a1cab14f5b5b /clang/lib | |
| parent | 5c56fb55b0857181d7bb89c40cce9d87c0942c00 (diff) | |
| download | bcm5719-llvm-6b07a1c6ee50dcf4d52a4a314b4774347f9b22c0.tar.gz bcm5719-llvm-6b07a1c6ee50dcf4d52a4a314b4774347f9b22c0.zip | |
Add -funique-section-names and -fno-unique-section-names options.
For now -funique-section-names is the default, so no change in default behavior.
The total .o size in a build of llvm and clang goes from 241687775 to 230649031
bytes if -fno-unique-section-names is used.
llvm-svn: 230031
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 3 |
3 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 7442f4374ca..da3e5ce6795 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -527,6 +527,7 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { Options.PositionIndependentExecutable = LangOpts.PIELevel != 0; Options.FunctionSections = CodeGenOpts.FunctionSections; Options.DataSections = CodeGenOpts.DataSections; + Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames; Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll; Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index b5f20608c14..dd878d0dfcd 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -3316,6 +3316,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-fdata-sections"); } + if (!Args.hasFlag(options::OPT_funique_section_names, + options::OPT_fno_unique_section_names, true)) + CmdArgs.push_back("-fno-unique-section-names"); + Args.AddAllArgs(CmdArgs, options::OPT_finstrument_functions); if (Args.hasArg(options::OPT_fprofile_instr_generate) && diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 7a53cedc93b..bfd9429dace 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -472,6 +472,9 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, OPT_fno_function_sections, false); Opts.DataSections = Args.hasFlag(OPT_fdata_sections, OPT_fno_data_sections, false); + Opts.UniqueSectionNames = Args.hasFlag(OPT_funique_section_names, + OPT_fno_unique_section_names, true); + Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions); Opts.MSVolatile = Args.hasArg(OPT_fms_volatile); |

