<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64194>64194</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang driver crashes in Debug mode for powerpc when given full triple
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          long5hot
      </td>
    </tr>
</table>

<pre>
    Compiling with :
`clang -target powerpc64-unknown-unknown-gnu -mabi=elfv2 test.c`

It should just give as release binary gives
`/usr/bin/ld: unrecognised emulation mode: elf64ppc
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om elf_k1om i386pep i386pe
clang: error: linker command failed with exit code 1 (use -v to see invocation)`

But instead it crashes with following stack trace..

`unsupported architecture
UNREACHABLE executed at /home/kishan/llvm/llvm-project/clang/lib/Driver/ToolChains/Hurd.cpp:132!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/kishan/llvm/clang_Official/debugBuild/bin//clang -target powerpc64-unknown-unknown-gnu -mabi=elfv2 test.c
1.      Compilation construction
2.      Building compilation jobs
3.      Building compilation jobs
 #0 0x000055c48678cbad llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/kishan/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:602:11
 #1 0x000055c48678d04b PrintStackTraceSignalHandler(void*) /home/kishan/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:675:1
 #2 0x000055c48678b306 llvm::sys::RunSignalHandlers() /home/kishan/llvm/llvm-project/llvm/lib/Support/Signals.cpp:104:5
 #3 0x000055c48678d805 SignalHandler(int) /home/kishan/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007fd33b442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007fd33b496a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007fd33b496a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007fd33b496a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007fd33b442476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007fd33b4287f3 abort ./stdlib/abort.c:81:7
#10 0x000055c4866cb530 llvm::install_out_of_memory_new_handler() /home/kishan/llvm/llvm-project/llvm/lib/Support/ErrorHandling.cpp:193:0
#11 0x000055c487655a79 (/home/kishan/llvm/clang_Official/debugBuild/bin//clang+0x4f4da79)
#12 0x000055c48762a5b7 clang::driver::tools::gnutools::Linker::ConstructJob(clang::driver::Compilation&, clang::driver::JobAction const&, clang::driver::InputInfo const&, llvm::SmallVector<clang::driver::InputInfo, 4u> const&, llvm::opt::ArgList const&, char const*) const /home/kishan/llvm/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp:471:44
#13 0x000055c4875263d3 clang::driver::Driver::BuildJobsForActionNoCache(clang::driver::Compilation&, clang::driver::Action const*, clang::driver::ToolChain const*, llvm::StringRef, bool, bool, char const*, std::map<std::pair<clang::driver::Action const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::SmallVector<clang::driver::InputInfo, 4u>, std::less<std::pair<clang::driver::Action const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::pair<std::pair<clang::driver::Action const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> const, llvm::SmallVector<clang::driver::InputInfo, 4u>>>>&, clang::driver::Action::OffloadKind) const /home/kishan/llvm/llvm-project/clang/lib/Driver/Driver.cpp:5633:7
#14 0x000055c487524760 clang::driver::Driver::BuildJobsForAction(clang::driver::Compilation&, clang::driver::Action const*, clang::driver::ToolChain const*, llvm::StringRef, bool, bool, char const*, std::map<std::pair<clang::driver::Action const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::SmallVector<clang::driver::InputInfo, 4u>, std::less<std::pair<clang::driver::Action const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::pair<std::pair<clang::driver::Action const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> const, llvm::SmallVector<clang::driver::InputInfo, 4u>>>>&, clang::driver::Action::OffloadKind) const /home/kishan/llvm/llvm-project/clang/lib/Driver/Driver.cpp:5324:3
#15 0x000055c48751adc2 clang::driver::Driver::BuildJobs(clang::driver::Compilation&) const /home/kishan/llvm/llvm-project/clang/lib/Driver/Driver.cpp:4859:5
#16 0x000055c48751638f clang::driver::Driver::BuildCompilation(llvm::ArrayRef<char const*>) /home/kishan/llvm/llvm-project/clang/lib/Driver/Driver.cpp:1508:10
#17 0x000055c483f3631e clang_main(int, char**, llvm::ToolContext const&) /home/kishan/llvm/llvm-project/clang/tools/driver/driver.cpp:512:44
#18 0x000055c483f692cd main /home/kishan/llvm/clang_Official/debugBuild/tools/clang/tools/driver/clang-driver.cpp:15:3
#19 0x00007fd33b429d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#20 0x00007fd33b429e40 call_init ./csu/../csu/libc-start.c:128:20
#21 0x00007fd33b429e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#22 0x000055c483f353c5 _start (/home/kishan/llvm/clang_Official/debugBuild/bin//clang+0x182d3c5)
Aborted (core dumped)`

The reason is, in triple when we give unknown as OS type it selects `hurd` instead of linux or Host OS.



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWUlv3DjT_jX0hXBDIrX1oQ8d2_1l5gsmQZx5rwJFURJjihS4ePn3L0iqF_XYHk9e5zBAgsBdkooPq55aKFLEGN5LxjYg_wDy6wvi7KD0RijZ54OyF41qnzZXapy44LKHD9wOEOAtSK5BsgVFQgWRPby0RPfMwkk9MD3RIrt08k6qB3n47aWDlyNpOMDXTHT3C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