[PATCH] D71082: Allow system header to provide their own implementation of some builtin

Amy Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 14:37:21 PST 2020


akhuang added a comment.

This caused a linker error in chromium:

  ld.lld: error: undefined symbol: __warn_memset_zero_len

Apparently now that the glibc memset is being used, __warn_memset_zero_len gets called from libc++ code (https://github.com/llvm/llvm-project/blob/b72a8c65e4e34779b6bc9e466203f553f5294486/libcxx/include/__bit_reference#L371).

A repro:

  $ cat t.cpp
  #include <bitset>
  void useit(std::bitset<3> &it);
  std::bitset<3> getit();
  int main() {
    std::bitset<3> bits = getit();
    bits.set();
    useit(bits);
  }
  
  $ clang -S -O2 t.cpp  -o - -stdlib=libc++ -D_FORTIFY_SOURCE=1 | grep warn_mem
          callq   __warn_memset_zero_len


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71082/new/

https://reviews.llvm.org/D71082





More information about the cfe-commits mailing list