1*67e74705SXin Li // A basic clang -cc1 command-line. WebAssembly is somewhat special in 2*67e74705SXin Li // enabling -ffunction-sections, -fdata-sections, and -fvisibility=hidden by 3*67e74705SXin Li // default. 4*67e74705SXin Li 5*67e74705SXin Li // RUN: %clang %s -### -no-canonical-prefixes -target wasm32-unknown-unknown 2>&1 | FileCheck -check-prefix=CC1 %s 6*67e74705SXin Li // CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} "-ffunction-sections" "-fdata-sections" 7*67e74705SXin Li 8*67e74705SXin Li // Ditto, but ensure that a user -fno-function-sections disables the 9*67e74705SXin Li // default -ffunction-sections. 10*67e74705SXin Li 11*67e74705SXin Li // RUN: %clang %s -### -target wasm32-unknown-unknown -fno-function-sections 2>&1 | FileCheck -check-prefix=NO_FUNCTION_SECTIONS %s 12*67e74705SXin Li // NO_FUNCTION_SECTIONS-NOT: function-sections 13*67e74705SXin Li 14*67e74705SXin Li // Ditto, but ensure that a user -fno-data-sections disables the 15*67e74705SXin Li // default -fdata-sections. 16*67e74705SXin Li 17*67e74705SXin Li // RUN: %clang %s -### -target wasm32-unknown-unknown -fno-data-sections 2>&1 | FileCheck -check-prefix=NO_DATA_SECTIONS %s 18*67e74705SXin Li // NO_DATA_SECTIONS-NOT: data-sections 19*67e74705SXin Li 20*67e74705SXin Li // Ditto, but ensure that a user -fvisibility=default disables the default 21*67e74705SXin Li // -fvisibility=hidden. 22*67e74705SXin Li 23*67e74705SXin Li // RUN: %clang %s -### -target wasm32-unknown-unknown -fvisibility=default 2>&1 | FileCheck -check-prefix=FVISIBILITY_DEFAULT %s 24*67e74705SXin Li // FVISIBILITY_DEFAULT-NOT: hidden 25*67e74705SXin Li 26*67e74705SXin Li // A basic C link command-line. 27*67e74705SXin Li 28*67e74705SXin Li // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=LINK %s 29*67e74705SXin Li // LINK: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" 30*67e74705SXin Li // LINK: lld{{.*}}" "-flavor" "ld" "-L/foo/lib32" "crt1.o" "crti.o" "[[temp]]" "-lc" "-lcompiler_rt" "crtn.o" "-o" "a.out" 31*67e74705SXin Li 32*67e74705SXin Li // A basic C link command-line with optimization. WebAssembly is somewhat 33*67e74705SXin Li // special in enabling --gc-sections by default. 34*67e74705SXin Li 35*67e74705SXin Li // RUN: %clang -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=LINK_OPT %s 36*67e74705SXin Li // LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" 37*67e74705SXin Li // LINK_OPT: lld{{.*}}" "-flavor" "ld" "--gc-sections" "-L/foo/lib32" "crt1.o" "crti.o" "[[temp]]" "-lc" "-lcompiler_rt" "crtn.o" "-o" "a.out" 38*67e74705SXin Li 39*67e74705SXin Li // Ditto, but ensure that a user --no-gc-sections comes after the 40*67e74705SXin Li // default --gc-sections. 41*67e74705SXin Li 42*67e74705SXin Li // RUN: %clang -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo -Wl,--no-gc-sections %s 2>&1 | FileCheck -check-prefix=NO_GC_SECTIONS %s 43*67e74705SXin Li // NO_GC_SECTIONS: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" 44*67e74705SXin Li // NO_GC_SECTIONS: lld{{.*}}" "-flavor" "ld" "--gc-sections" "-L/foo/lib32" "crt1.o" "crti.o" "--no-gc-sections" "[[temp]]" "-lc" "-lcompiler_rt" "crtn.o" "-o" "a.out" 45