Index: test/MC/Sparc/sparc-little-endian.s =================================================================== --- test/MC/Sparc/sparc-little-endian.s +++ test/MC/Sparc/sparc-little-endian.s @@ -1,5 +1,5 @@ -! RUN: llvm-mc %s -arch=sparcel -show-encoding | FileCheck %s -! RUN: llvm-mc -arch=sparcel -filetype=obj < %s | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-OBJ +! RUN: llvm-mc %s -triple=sparcel-linux-gnu -show-encoding | FileCheck %s +! RUN: llvm-mc -triple=sparcel-linux-gnu -filetype=obj < %s | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-OBJ ! CHECK-OBJ: .text: .BB0: Index: tools/llvm-mc/llvm-mc.cpp =================================================================== --- tools/llvm-mc/llvm-mc.cpp +++ tools/llvm-mc/llvm-mc.cpp @@ -383,7 +383,6 @@ cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n"); MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags(); TripleName = Triple::normalize(TripleName); - Triple TheTriple(TripleName); setDwarfDebugFlags(argc, argv); setDwarfDebugProducer(); @@ -392,6 +391,9 @@ const Target *TheTarget = GetTarget(ProgName); if (!TheTarget) return 1; + // Now that GetTarget() has (potentially) replaced TripleName, it's safe to + // construct the Triple object. + Triple TheTriple(TripleName); ErrorOr> BufferPtr = MemoryBuffer::getFileOrSTDIN(InputFilename);