diff options
author | Sam Clegg <sbc@chromium.org> | 2018-01-12 17:54:49 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2018-01-12 17:54:49 +0000 |
commit | ffbfc0f8274e2befe0aa837ec3d2b36e03ba6c09 (patch) | |
tree | 2fc94d46b9da382b7e549e325b0b63ad42ec0f1f /clang/test/Driver/wasm-toolchain.cpp | |
parent | cb09bd12271a7c1c44da3597c65b469a06948dea (diff) | |
download | bcm5719-llvm-ffbfc0f8274e2befe0aa837ec3d2b36e03ba6c09.tar.gz bcm5719-llvm-ffbfc0f8274e2befe0aa837ec3d2b36e03ba6c09.zip |
[WebAssembly] Support -stdlib=libc++ switch
Referenced implementation from Fuchsia and Darwin Toolchain.
Still only support CST_Libcxx. Now checks that the argument
is really '-stdlib=libc++', and display error.
Also, now will pass -lc++ and -lc++abi to the linker.
Patch by Patrick Cheng!
Differential Revision: https://reviews.llvm.org/D41937
llvm-svn: 322382
Diffstat (limited to 'clang/test/Driver/wasm-toolchain.cpp')
-rw-r--r-- | clang/test/Driver/wasm-toolchain.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/clang/test/Driver/wasm-toolchain.cpp b/clang/test/Driver/wasm-toolchain.cpp new file mode 100644 index 00000000000..799e0273846 --- /dev/null +++ b/clang/test/Driver/wasm-toolchain.cpp @@ -0,0 +1,36 @@ +// A basic clang -cc1 command-line. WebAssembly is somewhat special in +// enabling -ffunction-sections, -fdata-sections, and -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 + +// Ditto, but ensure that a user -fvisibility=default disables the default +// -fvisibility=hidden. + +// RUN: %clang++ %s -### -target wasm32-unknown-unknown -fvisibility=default 2>&1 | FileCheck -check-prefix=FVISIBILITY_DEFAULT %s +// FVISIBILITY_DEFAULT-NOT: hidden + +// A basic C++ link command-line. + +// RUN: %clang++ -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo --stdlib=c++ %s 2>&1 | FileCheck -check-prefix=LINK %s +// LINK: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" +// LINK: lld{{.*}}" "-flavor" "wasm" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out" + +// A basic C++ link command-line with optimization. + +// RUN: %clang++ -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s --stdlib=c++ 2>&1 | FileCheck -check-prefix=LINK_OPT %s +// LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" +// LINK_OPT: lld{{.*}}" "-flavor" "wasm" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out" |