yaxunl created this revision. yaxunl added reviewers: tra, MaskRay. Herald added a subscriber: jeroen.dobbelaere. Herald added a project: All. yaxunl requested review of this revision.
HIP runtime is the language runtime of HIP. When users need to specify rpath, they usually need to specify rpath for both compiler-rt and HIP runtime. It seems redundant to have separate options. Therefore make `--offload-add-rpath` an alias to `-frtlib-add-rpath`. https://reviews.llvm.org/D145393 Files: clang/include/clang/Driver/Options.td clang/lib/Driver/ToolChains/Linux.cpp clang/test/Driver/hip-runtime-libs-linux.hip Index: clang/test/Driver/hip-runtime-libs-linux.hip =================================================================== --- clang/test/Driver/hip-runtime-libs-linux.hip +++ clang/test/Driver/hip-runtime-libs-linux.hip @@ -13,7 +13,7 @@ // RUN: | FileCheck -check-prefixes=ROCM-PATH %s // RUN: %clang -### --hip-link --target=x86_64-linux-gnu \ -// RUN: --rocm-path=%S/Inputs/rocm %t.o --offload-add-rpath 2>&1 \ +// RUN: --rocm-path=%S/Inputs/rocm %t.o -frtlib-add-rpath 2>&1 \ // RUN: | FileCheck -check-prefixes=ROCM-RPATH %s // Test detecting latest /opt/rocm-{release} directory. Index: clang/lib/Driver/ToolChains/Linux.cpp =================================================================== --- clang/lib/Driver/ToolChains/Linux.cpp +++ clang/lib/Driver/ToolChains/Linux.cpp @@ -694,8 +694,8 @@ CmdArgs.push_back( Args.MakeArgString(StringRef("-L") + RocmInstallation->getLibPath())); - if (Args.hasFlag(options::OPT_offload_add_rpath, - options::OPT_no_offload_add_rpath, false)) + if (Args.hasFlag(options::OPT_frtlib_add_rpath, + options::OPT_fno_rtlib_add_rpath, false)) CmdArgs.append( {"-rpath", Args.MakeArgString(RocmInstallation->getLibPath())}); Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4253,13 +4253,15 @@ def rtlib_EQ : Joined<["-", "--"], "rtlib=">, HelpText<"Compiler runtime library to use">; def frtlib_add_rpath: Flag<["-"], "frtlib-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Add -rpath with architecture-specific resource directory to the linker flags">; + HelpText<"Add -rpath with architecture-specific resource directory to the linker flags. " + "When --hip-link is specified, also add -rpath with HIP runtime library directory to the linker flags">; def fno_rtlib_add_rpath: Flag<["-"], "fno-rtlib-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Do not add -rpath with architecture-specific resource directory to the linker flags">; + HelpText<"Do not add -rpath with architecture-specific resource directory to the linker flags. " + "When --hip-link is specified, do not add -rpath with HIP runtime library directory to the linker flags">; def offload_add_rpath: Flag<["--"], "offload-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Add -rpath with HIP runtime library directory to the linker flags">; + Alias<frtlib_add_rpath>; def no_offload_add_rpath: Flag<["--"], "no-offload-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Do not add -rpath with HIP runtime library directory to the linker flags">; + Alias<frtlib_add_rpath>; defm openmp_implicit_rpath: BoolFOption<"openmp-implicit-rpath", LangOpts<"OpenMP">, DefaultTrue,
Index: clang/test/Driver/hip-runtime-libs-linux.hip =================================================================== --- clang/test/Driver/hip-runtime-libs-linux.hip +++ clang/test/Driver/hip-runtime-libs-linux.hip @@ -13,7 +13,7 @@ // RUN: | FileCheck -check-prefixes=ROCM-PATH %s // RUN: %clang -### --hip-link --target=x86_64-linux-gnu \ -// RUN: --rocm-path=%S/Inputs/rocm %t.o --offload-add-rpath 2>&1 \ +// RUN: --rocm-path=%S/Inputs/rocm %t.o -frtlib-add-rpath 2>&1 \ // RUN: | FileCheck -check-prefixes=ROCM-RPATH %s // Test detecting latest /opt/rocm-{release} directory. Index: clang/lib/Driver/ToolChains/Linux.cpp =================================================================== --- clang/lib/Driver/ToolChains/Linux.cpp +++ clang/lib/Driver/ToolChains/Linux.cpp @@ -694,8 +694,8 @@ CmdArgs.push_back( Args.MakeArgString(StringRef("-L") + RocmInstallation->getLibPath())); - if (Args.hasFlag(options::OPT_offload_add_rpath, - options::OPT_no_offload_add_rpath, false)) + if (Args.hasFlag(options::OPT_frtlib_add_rpath, + options::OPT_fno_rtlib_add_rpath, false)) CmdArgs.append( {"-rpath", Args.MakeArgString(RocmInstallation->getLibPath())}); Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4253,13 +4253,15 @@ def rtlib_EQ : Joined<["-", "--"], "rtlib=">, HelpText<"Compiler runtime library to use">; def frtlib_add_rpath: Flag<["-"], "frtlib-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Add -rpath with architecture-specific resource directory to the linker flags">; + HelpText<"Add -rpath with architecture-specific resource directory to the linker flags. " + "When --hip-link is specified, also add -rpath with HIP runtime library directory to the linker flags">; def fno_rtlib_add_rpath: Flag<["-"], "fno-rtlib-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Do not add -rpath with architecture-specific resource directory to the linker flags">; + HelpText<"Do not add -rpath with architecture-specific resource directory to the linker flags. " + "When --hip-link is specified, do not add -rpath with HIP runtime library directory to the linker flags">; def offload_add_rpath: Flag<["--"], "offload-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Add -rpath with HIP runtime library directory to the linker flags">; + Alias<frtlib_add_rpath>; def no_offload_add_rpath: Flag<["--"], "no-offload-add-rpath">, Flags<[NoArgumentUnused]>, - HelpText<"Do not add -rpath with HIP runtime library directory to the linker flags">; + Alias<frtlib_add_rpath>; defm openmp_implicit_rpath: BoolFOption<"openmp-implicit-rpath", LangOpts<"OpenMP">, DefaultTrue,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits