From 317550fcfa3038e7d2f4b54c8339b9dc70be5edb Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 31 Jan 2018 18:55:22 +0000 Subject: [PATCH] [WebAssembly] Don't pass -ffunction-section/-fdata-sections llvm currently forces both of these to true to passing them is redundant. Differential Revision: https://reviews.llvm.org/D37831 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323897 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains/CommonArgs.cpp | 7 ++----- test/Driver/wasm-toolchain.c | 17 ++--------------- test/Driver/wasm-toolchain.cpp | 17 ++--------------- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp index f5c0b7f8cc..a8ec8b1078 100644 --- a/lib/Driver/ToolChains/CommonArgs.cpp +++ b/lib/Driver/ToolChains/CommonArgs.cpp @@ -363,12 +363,9 @@ unsigned tools::getLTOParallelism(const ArgList &Args, const Driver &D) { return Parallelism; } -// CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by -// default. +// CloudABI uses -ffunction-sections and -fdata-sections by default. bool tools::isUseSeparateSections(const llvm::Triple &Triple) { - return Triple.getOS() == llvm::Triple::CloudABI || - Triple.getArch() == llvm::Triple::wasm32 || - Triple.getArch() == llvm::Triple::wasm64; + return Triple.getOS() == llvm::Triple::CloudABI; } void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args, diff --git a/test/Driver/wasm-toolchain.c b/test/Driver/wasm-toolchain.c index daa2f16d08..b1f5f48f87 100644 --- a/test/Driver/wasm-toolchain.c +++ b/test/Driver/wasm-toolchain.c @@ -1,21 +1,8 @@ // A basic clang -cc1 command-line. WebAssembly is somewhat special in -// enabling -ffunction-sections, -fdata-sections, and -fvisibility=hidden by -// default. +// enabling -fvisibility=hidden by default. // RUN: %clang %s -### -no-canonical-prefixes -target wasm32-unknown-unknown 2>&1 | FileCheck -check-prefix=CC1 %s -// CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} "-ffunction-sections" "-fdata-sections" - -// Ditto, but ensure that a user -fno-function-sections disables the -// default -ffunction-sections. - -// RUN: %clang %s -### -target wasm32-unknown-unknown -fno-function-sections 2>&1 | FileCheck -check-prefix=NO_FUNCTION_SECTIONS %s -// NO_FUNCTION_SECTIONS-NOT: function-sections - -// Ditto, but ensure that a user -fno-data-sections disables the -// default -fdata-sections. - -// RUN: %clang %s -### -target wasm32-unknown-unknown -fno-data-sections 2>&1 | FileCheck -check-prefix=NO_DATA_SECTIONS %s -// NO_DATA_SECTIONS-NOT: data-sections +// CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} // Ditto, but ensure that a user -fvisibility=default disables the default // -fvisibility=hidden. diff --git a/test/Driver/wasm-toolchain.cpp b/test/Driver/wasm-toolchain.cpp index 64100839ba..ea3aa31398 100644 --- a/test/Driver/wasm-toolchain.cpp +++ b/test/Driver/wasm-toolchain.cpp @@ -1,21 +1,8 @@ // A basic clang -cc1 command-line. WebAssembly is somewhat special in -// enabling -ffunction-sections, -fdata-sections, and -fvisibility=hidden by -// default. +// enabling -fvisibility=hidden by default. // RUN: %clangxx %s -### -no-canonical-prefixes -target wasm32-unknown-unknown 2>&1 | FileCheck -check-prefix=CC1 %s -// CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} "-ffunction-sections" "-fdata-sections" - -// Ditto, but ensure that a user -fno-function-sections disables the -// default -ffunction-sections. - -// RUN: %clangxx %s -### -target wasm32-unknown-unknown -fno-function-sections 2>&1 | FileCheck -check-prefix=NO_FUNCTION_SECTIONS %s -// NO_FUNCTION_SECTIONS-NOT: function-sections - -// Ditto, but ensure that a user -fno-data-sections disables the -// default -fdata-sections. - -// RUN: %clangxx %s -### -target wasm32-unknown-unknown -fno-data-sections 2>&1 | FileCheck -check-prefix=NO_DATA_SECTIONS %s -// NO_DATA_SECTIONS-NOT: data-sections +// CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} // Ditto, but ensure that a user -fvisibility=default disables the default // -fvisibility=hidden. -- 2.40.0