Index: lib/Driver/ToolChains.h =================================================================== --- lib/Driver/ToolChains.h +++ lib/Driver/ToolChains.h @@ -930,6 +930,8 @@ Tool *SelectTool(const JobAction &JA) const override; void getCompilerSupportDir(std::string &Dir) const; void getBuiltinLibDir(std::string &Dir) const; + void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; protected: Tool *getTool(Action::ActionClass AC) const override; Index: lib/Driver/ToolChains.cpp =================================================================== --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -3957,6 +3957,13 @@ } } +void MyriadToolChain::addClangTargetOptions( + const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const { + // Myriad debugger can't parse dwarf-4 (the default). + CC1Args.push_back("-gdwarf-3"); +} + void MyriadToolChain::getCompilerSupportDir(std::string &Dir) const { // This directory contains crt{i,n,begin,end}.o as well as libgcc. // These files are tied to a particular version of gcc. Index: test/Driver/myriad-toolchain.c =================================================================== --- /dev/null +++ test/Driver/myriad-toolchain.c @@ -0,0 +1,43 @@ +// RUN: %clang -no-canonical-prefixes -### -target sparc-myriad -c %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=GDWARF3 +// GDWARF3: "-gdwarf-3" + +// RUN: %clang -no-canonical-prefixes -### -target sparc-myriad-rtems-elf %s \ +// RUN: -B %S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=LINK_WITH_RTEMS +// LINK_WITH_RTEMS: crti.o +// LINK_WITH_RTEMS: crtbegin.o +// LINK_WITH_RTEMS: -lrtems + +// Ensure that '-target shave' picks a different compiler. +// Also check that '-I' is turned into '-i:' for the assembler. + +// Note that since we don't know where movi tools are installed, +// the driver may or may not find a full path to them. +// That is, the 0th argument will be "/path/to/my/moviCompile" +// or just "moviCompile" depending on whether moviCompile is found. +// As such, we test only for a trailing quote in its rendering. +// The same goes for "moviAsm". + +// RUN: %clang -target shave-myriad -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \ +// RUN: | FileCheck %s -check-prefix=MOVICOMPILE +// MOVICOMPILE: moviCompile" "-DMYRIAD2" "-mcpu=myriad2" "-S" "-isystem" "somewhere" "-I" "common" +// MOVICOMPILE: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a" +// MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common" "-elf" + +// RUN: %clang -target shave-myriad -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \ +// RUN: | FileCheck %s -check-prefix=DEFINES +// DEFINES: "-D" "EFINE_ME" "-U" "NDEFINE_ME" + +// RUN: %clang -target shave-myriad -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \ +// RUN: | FileCheck %s -check-prefix=INCLUDES +// INCLUDES: "-iquote" "quotepath" "-isystem" "syspath" + +// RUN: %clang -target shave-myriad -c -### %s -g -fno-inline-functions \ +// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d \ +// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=PASSTHRU_OPTIONS +// PASSTHRU_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once" +// PASSTHRU_OPTIONS: "-Os" "-Wall" "-MF" "dep.d" "-ffunction-sections" + +// RUN: %clang -target shave-myriad -c %s -o foo.o -### -MD -MF dep.d 2>&1 \ +// RUN: | FileCheck %s -check-prefix=MDMF +// MDMF: "-S" "-MD" "-MF" "dep.d" "-MT" "foo.o" Index: test/Driver/shave-toolchain.c =================================================================== --- test/Driver/shave-toolchain.c +++ /dev/null @@ -1,39 +0,0 @@ -// RUN: %clang -no-canonical-prefixes -### -target sparc-myriad-rtems-elf %s \ -// RUN: -B %S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=LINK_WITH_RTEMS -// LINK_WITH_RTEMS: crti.o -// LINK_WITH_RTEMS: crtbegin.o -// LINK_WITH_RTEMS: -lrtems - -// Ensure that '-target shave' picks a different compiler. -// Also check that '-I' is turned into '-i:' for the assembler. - -// Note that since we don't know where movi tools are installed, -// the driver may or may not find a full path to them. -// That is, the 0th argument will be "/path/to/my/moviCompile" -// or just "moviCompile" depending on whether moviCompile is found. -// As such, we test only for a trailing quote in its rendering. -// The same goes for "moviAsm". - -// RUN: %clang -target shave-myriad -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \ -// RUN: | FileCheck %s -check-prefix=MOVICOMPILE -// MOVICOMPILE: moviCompile" "-DMYRIAD2" "-mcpu=myriad2" "-S" "-isystem" "somewhere" "-I" "common" -// MOVICOMPILE: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a" -// MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common" "-elf" - -// RUN: %clang -target shave-myriad -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \ -// RUN: | FileCheck %s -check-prefix=DEFINES -// DEFINES: "-D" "EFINE_ME" "-U" "NDEFINE_ME" - -// RUN: %clang -target shave-myriad -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \ -// RUN: | FileCheck %s -check-prefix=INCLUDES -// INCLUDES: "-iquote" "quotepath" "-isystem" "syspath" - -// RUN: %clang -target shave-myriad -c -### %s -g -fno-inline-functions \ -// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d \ -// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=PASSTHRU_OPTIONS -// PASSTHRU_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once" -// PASSTHRU_OPTIONS: "-Os" "-Wall" "-MF" "dep.d" "-ffunction-sections" - -// RUN: %clang -target shave-myriad -c %s -o foo.o -### -MD -MF dep.d 2>&1 \ -// RUN: | FileCheck %s -check-prefix=MDMF -// MDMF: "-S" "-MD" "-MF" "dep.d" "-MT" "foo.o"