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

    <tr>
        <th>Summary</th>
        <td>
            Cannot build rust std with llvm-libc
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

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

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

<pre>
    Tracking what is needed:
```
  = note: /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000001000
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `version_lock_lock_exclusive':
          (.text+0x6d2): undefined reference to `pthread_cond_wait'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_allocate_node':
          (.text+0x1b1b): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x1b47): undefined reference to `malloc'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_remove':
          (.text+0x295d): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x2c56): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x3a28): undefined reference to `pthread_cond_broadcast'
 /usr/bin/ld: (.text+0x42b2): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x4327): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o):(.text+0x4356): more undefined references to `pthread_cond_broadcast' follow
 /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__deregister_frame_info_bases.part.0':
          (.text+0x4938): undefined reference to `free'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_insert.isra.0':
          (.text+0x4f19): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x58b6): undefined reference to `pthread_cond_broadcast'
 /usr/bin/ld: (.text+0x5900): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x5937): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x5999): undefined reference to `pthread_cond_broadcast'
 /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o):(.text+0x5aa9): more undefined references to `pthread_cond_broadcast' follow
 /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_insert.isra.0':
          (.text+0x5b28): undefined reference to `malloc'
          /usr/bin/ld: (.text+0x5c7b): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x5eb1): undefined reference to `pthread_cond_broadcast'
 /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__register_frame':
          (.text+0x62db): undefined reference to `malloc'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__register_frame_table':
          (.text+0x637f): undefined reference to `malloc'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__deregister_frame':
          (.text+0x6412): undefined reference to `free'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `_Unwind_Find_FDE':
          (.text+0x645d): undefined reference to `_dl_find_object'
          /usr/bin/ld: (.text+0x6650): undefined reference to `_dl_find_object'
          /usr/bin/ld: (.text+0x6c84): undefined reference to `malloc'
          /usr/bin/ld: (.text+0x6ca1): undefined reference to `malloc'
          /usr/bin/ld: (.text+0x6d69): undefined reference to `free'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_release_tree_recursively':
          (.text.exit+0x4fa): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text.exit+0x53a): undefined reference to `pthread_cond_broadcast'
 /usr/bin/ld: (.text.exit+0x57a): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text.exit+0x5ba): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text.exit+0x5f9): undefined reference to `pthread_cond_broadcast'
 /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o):(.text.exit+0x63a): more undefined references to `pthread_cond_broadcast' follow
 /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_destroy':
          (.text.exit+0x739): undefined reference to `free'
          /usr/bin/ld: /home/schrodingerzy/Documents/rust-linux-llvm/target/x86_64-llvm-linux-gnu/release/build/llvmlibc-src-88805f0fbbe903d2/out/build/lib/libc.a(dir.cpp.o): in function `__llvm_libc::internal::convert_clock(timespec, int, int)':
 dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x42): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x4e): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x55): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x61): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x70): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x7c): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x83): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x8f): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x9f): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xab): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xb2): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xbe): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xc9): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xd5): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xdc): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xe8): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
 /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x106): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
 /usr/bin/ld: /home/schrodingerzy/Documents/rust-linux-llvm/target/x86_64-llvm-linux-gnu/release/examples/hello-5fd76d54e23d8ded: hidden symbol `_ZN11__llvm_libc4vdso6Symbol9once_flagE' isn't defined
 /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWk9z4j4S_TTiosJly3-wDxySyfi4l9m9zMWlP21bGyFRkkzIfPotAyEhOxU7A8MA86MosCnRz6-7X6stizonGw0wR-k9Sh8mtPOtsfNvvLVGSN2A_d52E2bE8_zflvJHqRv81FKPpcMaQIBA8R0KH1B4h7Jw996cYoziB6yNBxTfYUTKzllESiY1IqXq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