This revision was automatically updated to reflect the committed changes. Closed by commit rL341077: [HIP] Add -fvisibility hidden option to clang (authored by yaxunl, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D51434?vs=163196&id=163340#toc Repository: rL LLVM https://reviews.llvm.org/D51434 Files: cfe/trunk/lib/Driver/ToolChains/HIP.cpp cfe/trunk/test/Driver/hip-toolchain.hip Index: cfe/trunk/test/Driver/hip-toolchain.hip =================================================================== --- cfe/trunk/test/Driver/hip-toolchain.hip +++ cfe/trunk/test/Driver/hip-toolchain.hip @@ -15,13 +15,15 @@ // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" -// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" -// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]] // CHECK: [[LLVM_LINK:"*.llvm-link"]] [[A_BC]] [[B_BC]] Index: cfe/trunk/lib/Driver/ToolChains/HIP.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/HIP.cpp +++ cfe/trunk/lib/Driver/ToolChains/HIP.cpp @@ -247,6 +247,12 @@ if (DriverArgs.hasFlag(options::OPT_fcuda_rdc, options::OPT_fno_cuda_rdc, false)) CC1Args.push_back("-fcuda-rdc"); + + // Default to "hidden" visibility, as object level linking will not be + // supported for the foreseeable future. + if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ, + options::OPT_fvisibility_ms_compat)) + CC1Args.append({"-fvisibility", "hidden"}); } llvm::opt::DerivedArgList *
Index: cfe/trunk/test/Driver/hip-toolchain.hip =================================================================== --- cfe/trunk/test/Driver/hip-toolchain.hip +++ cfe/trunk/test/Driver/hip-toolchain.hip @@ -15,13 +15,15 @@ // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" -// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" -// CHECK-SAME: "-fcuda-is-device" {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]] // CHECK: [[LLVM_LINK:"*.llvm-link"]] [[A_BC]] [[B_BC]] Index: cfe/trunk/lib/Driver/ToolChains/HIP.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/HIP.cpp +++ cfe/trunk/lib/Driver/ToolChains/HIP.cpp @@ -247,6 +247,12 @@ if (DriverArgs.hasFlag(options::OPT_fcuda_rdc, options::OPT_fno_cuda_rdc, false)) CC1Args.push_back("-fcuda-rdc"); + + // Default to "hidden" visibility, as object level linking will not be + // supported for the foreseeable future. + if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ, + options::OPT_fvisibility_ms_compat)) + CC1Args.append({"-fvisibility", "hidden"}); } llvm::opt::DerivedArgList *
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits