diff --git a/clang/lib/Driver/ToolChains/VEToolchain.cpp b/clang/lib/Driver/ToolChains/VEToolchain.cpp --- a/clang/lib/Driver/ToolChains/VEToolchain.cpp +++ b/clang/lib/Driver/ToolChains/VEToolchain.cpp @@ -28,17 +28,27 @@ getProgramPaths().push_back("/opt/nec/ve/bin"); // ProgramPaths are found via 'PATH' environment variable. - // default file paths are: - // ${RESOURCEDIR}/lib/linux/ve (== getArchSpecificLibPath) - // /lib/../lib64 - // /usr/lib/../lib64 - // ${BINPATH}/../lib - // /lib - // /usr/lib - // - // These are OK for host, but no go for VE. So, defines them all - // from scratch here. + // Default library paths are following: + // ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, + // These are OK. + + // Default file paths are following: + // ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPath) + // /lib/../lib64, + // /usr/lib/../lib64, + // ${BINPATH}/../lib, + // /lib, + // /usr/lib, + // These are OK for host, but no go for VE. + + // Define file paths from scratch here. getFilePaths().clear(); + + // Add library directories: + // ${BINPATH}/../lib/ve-unknown-linux-gnu, (== getStdlibPath) + // ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPath) + // ${SYSROOT}/opt/nec/ve/lib, + getFilePaths().push_back(getStdlibPath()); getFilePaths().push_back(getArchSpecificLibPath()); getFilePaths().push_back(computeSysRoot() + "/opt/nec/ve/lib"); } @@ -115,9 +125,10 @@ ArrayRef DirVec(Dirs); addSystemIncludes(DriverArgs, CC1Args, DirVec); } else { - SmallString<128> P(getDriver().ResourceDir); - llvm::sys::path::append(P, "include/c++/v1"); - addSystemInclude(DriverArgs, CC1Args, P); + // Add following paths for multiple target installation. + // ${INSTALLDIR}/include/ve-unknown-linux-gnu/c++/v1, + // ${INSTALLDIR}/include/c++/v1, + addLibCxxIncludePaths(DriverArgs, CC1Args); } } diff --git a/clang/test/Driver/Inputs/basic_ve_tree/bin/.keep b/clang/test/Driver/Inputs/basic_ve_tree/bin/.keep new file mode 100644 diff --git a/clang/test/Driver/Inputs/basic_ve_tree/include/c++/v1/.keep b/clang/test/Driver/Inputs/basic_ve_tree/include/c++/v1/.keep new file mode 100644 diff --git a/clang/test/Driver/Inputs/basic_ve_tree/include/ve-unknown-linux-gnu/c++/v1/.keep b/clang/test/Driver/Inputs/basic_ve_tree/include/ve-unknown-linux-gnu/c++/v1/.keep new file mode 100644 diff --git a/clang/test/Driver/ve-toolchain.c b/clang/test/Driver/ve-toolchain.c --- a/clang/test/Driver/ve-toolchain.c +++ b/clang/test/Driver/ve-toolchain.c @@ -12,7 +12,7 @@ /// Checking include-path // RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: 2>&1 | FileCheck -check-prefix=DEFINC %s // DEFINC: clang{{.*}} "-cc1" // DEFINC-SAME: "-nostdsysteminc" @@ -22,7 +22,7 @@ // DEFINC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" // RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: -nostdlibinc 2>&1 | FileCheck -check-prefix=NOSTDLIBINC %s // NOSTDLIBINC: clang{{.*}} "-cc1" // NOSTDLIBINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" @@ -31,7 +31,7 @@ // NOSTDLIBINC-NOT: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" // RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: -nobuiltininc 2>&1 | FileCheck -check-prefix=NOBUILTININC %s // NOBUILTININC: clang{{.*}} "-cc1" // NOBUILTININC-SAME: "-nobuiltininc" @@ -41,7 +41,7 @@ // NOBUILTININC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" // RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: -nostdinc 2>&1 | FileCheck -check-prefix=NOSTDINC %s // NOSTDINC: clang{{.*}} "-cc1" // NOSTDINC-SAME: "-nobuiltininc" diff --git a/clang/test/Driver/ve-toolchain.cpp b/clang/test/Driver/ve-toolchain.cpp --- a/clang/test/Driver/ve-toolchain.cpp +++ b/clang/test/Driver/ve-toolchain.cpp @@ -5,72 +5,89 @@ ///----------------------------------------------------------------------------- /// Checking dwarf-version -// RUN: %clangxx -### -g -target ve %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s +// RUN: %clangxx -### -g -target ve-unknown-linux-gnu \ +// RUN: %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s // DWARF_VER: "-dwarf-version=4" ///----------------------------------------------------------------------------- /// Checking include-path -// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: --sysroot %S/Inputs/basic_ve_tree %s \ +// RUN: -ccc-install-dir %S/Inputs/basic_ve_tree/bin \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: 2>&1 | FileCheck -check-prefix=DEFINC %s // DEFINC: clang{{.*}} "-cc1" // DEFINC-SAME: "-nostdsysteminc" // DEFINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // DEFINC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" -// DEFINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1" +// DEFINC-SAME: "-internal-isystem" "{{.*}}/bin/../include/ve-unknown-linux-gnu/c++/v1" +// DEFINC-SAME: "-internal-isystem" "{{.*}}/bin/../include/c++/v1" // DEFINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include" // DEFINC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" -// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: --sysroot %S/Inputs/basic_ve_tree %s \ +// RUN: -ccc-install-dir %S/Inputs/basic_ve_tree/bin \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: -nostdlibinc 2>&1 | FileCheck -check-prefix=NOSTDLIBINC %s // NOSTDLIBINC: clang{{.*}} "-cc1" // NOSTDLIBINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // NOSTDLIBINC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" -// NOSTDLIBINC-NOT: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1" +// NOSTDLIBINC-NOT: "-internal-isystem" "{{.*}}/bin/../include/ve-unknown-linux-gnu/c++/v1" +// NOSTDLIBINC-NOT: "-internal-isystem" "{{.*}}/bin/../include/c++/v1" // NOSTDLIBINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include" // NOSTDLIBINC-NOT: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" -// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: --sysroot %S/Inputs/basic_ve_tree %s \ +// RUN: -ccc-install-dir %S/Inputs/basic_ve_tree/bin \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: -nobuiltininc 2>&1 | FileCheck -check-prefix=NOBUILTININC %s // NOBUILTININC: clang{{.*}} "-cc1" // NOBUILTININC-SAME: "-nobuiltininc" // NOBUILTININC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // NOBUILTININC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" -// NOBUILTININC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1" +// NOBUILTININC-SAME: "-internal-isystem" "{{.*}}/bin/../include/ve-unknown-linux-gnu/c++/v1" +// NOBUILTININC-SAME: "-internal-isystem" "{{.*}}/bin/../include/c++/v1" // NOBUILTININC-NOT: "-internal-isystem" "[[RESOURCE_DIR]]/include" // NOBUILTININC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" -// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: --sysroot %S/Inputs/basic_ve_tree %s \ +// RUN: -ccc-install-dir %S/Inputs/basic_ve_tree/bin \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: -nostdinc 2>&1 | FileCheck -check-prefix=NOSTDINC %s // NOSTDINC: clang{{.*}} "-cc1" // NOSTDINC-SAME: "-nobuiltininc" // NOSTDINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // NOSTDINC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" -// NOSTDINC-NOT: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1" +// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/bin/../include/ve-unknown-linux-gnu/c++/v1" +// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/bin/../include/c++/v1" // NOSTDINC-NOT: "-internal-isystem" "[[RESOURCE_DIR]]/include" // NOSTDINC-NOT: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" -// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: --sysroot %S/Inputs/basic_ve_tree %s \ +// RUN: -ccc-install-dir %S/Inputs/basic_ve_tree/bin \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: -nostdinc++ 2>&1 | FileCheck -check-prefix=NOSTDINCXX %s // NOSTDINCXX: clang{{.*}} "-cc1" // NOSTDINCXX-SAME: "-nostdinc++" // NOSTDINCXX-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // NOSTDINCXX-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" -// NOSTDINCXX-NOT: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1" +// NOSTDINCXX-NOT: "-internal-isystem" "{{.*}}/bin/../include/ve-unknown-linux-gnu/c++/v1" +// NOSTDINCXX-NOT: "-internal-isystem" "{{.*}}/bin/../include/c++/v1" // NOSTDINCXX-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include" // NOSTDINCXX-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include" ///----------------------------------------------------------------------------- /// Checking environment variable NCC_CPLUS_INCLUDE_PATH -// RUN: env NCC_CPLUS_INCLUDE_PATH=/test/test %clangxx -### -target ve %s \ +// RUN: env NCC_CPLUS_INCLUDE_PATH=/test/test %clangxx -### \ +// RUN: -target ve-unknown-linux-gnu %s \ // RUN: --sysroot %S/Inputs/basic_ve_tree \ -// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \ +// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \ // RUN: 2>&1 | FileCheck -check-prefix=DEFINCENV %s // DEFINCENV: clang{{.*}} "-cc1" @@ -84,18 +101,19 @@ ///----------------------------------------------------------------------------- /// Checking -faddrsig -// RUN: %clangxx -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFADDRSIG %s +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: %s 2>&1 | FileCheck -check-prefix=DEFADDRSIG %s // DEFADDRSIG: clang{{.*}} "-cc1" // DEFADDRSIG-NOT: "-faddrsig" ///----------------------------------------------------------------------------- /// Checking -fintegrated-as -// RUN: %clangxx -### -target ve \ -// RUN: -x assembler -fuse-ld=ld %s 2>&1 | \ +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: -x assembler -fuse-ld=ld %s 2>&1 | \ // RUN: FileCheck -check-prefix=AS %s -// RUN: %clangxx -### -target ve \ -// RUN: -fno-integrated-as -x assembler -fuse-ld=ld %s 2>&1 | \ +// RUN: %clangxx -### -target ve-unknown-linux-gnu \ +// RUN: -fno-integrated-as -x assembler -fuse-ld=ld %s 2>&1 | \ // RUN: FileCheck -check-prefix=NAS %s // AS: clang{{.*}} "-cc1as"