diff options
author | Dan Gohman <dan433584@gmail.com> | 2016-01-07 00:50:27 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2016-01-07 00:50:27 +0000 |
commit | a5b804be6113c23bbfd4629c2548a75d353a5a62 (patch) | |
tree | 1cd09a1437f885e46255faf3783204f2bbc89d64 /clang/lib/Driver/Tools.cpp | |
parent | 4e480206b288d82c5cb525e739d39da346c64c55 (diff) | |
download | llvm-a5b804be6113c23bbfd4629c2548a75d353a5a62.zip llvm-a5b804be6113c23bbfd4629c2548a75d353a5a62.tar.gz llvm-a5b804be6113c23bbfd4629c2548a75d353a5a62.tar.bz2 |
[WebAssembly] Enable -ffunction-sections and -fdata-sections by default.
These remain user-overridable with -fno-function-sections and
-fno-data-sections.
llvm-svn: 257005
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 0236e61..1584991 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4176,8 +4176,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-generate-type-units"); } - // CloudABI uses -ffunction-sections and -fdata-sections by default. - bool UseSeparateSections = Triple.getOS() == llvm::Triple::CloudABI; + // CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by + // default. + bool UseSeparateSections = Triple.getOS() == llvm::Triple::CloudABI || + Triple.getArch() == llvm::Triple::wasm32 || + Triple.getArch() == llvm::Triple::wasm64; if (Args.hasFlag(options::OPT_ffunction_sections, options::OPT_fno_function_sections, UseSeparateSections)) { @@ -6536,7 +6539,9 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("ld"); // Enable garbage collection of unused input sections by default, since code - // size is of particular importance. + // size is of particular importance. This is significantly facilitated by + // the enabling of -ffunction-sections and -fdata-sections in + // Clang::ConstructJob. if (areOptimizationsEnabled(Args)) CmdArgs.push_back("--gc-sections"); |