[PATCH] D36870: [libcxx] Add missing __cxa_deleted_virtual

Stephan Bergmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 04:33:46 PDT 2017


sberg created this revision.
Herald added subscribers: aprantl, mehdi_amini.

At least on macOS, libc++ fails to advertise __cxa_deleted_virtual from the underlying libc++abi:

  ~ cat test.cc
  struct S { virtual void f() = delete; };
  int main() { new S; }
  
  ~ clang++ -v -std=c++11 test.cc
  Apple LLVM version 8.1.0 (clang-802.0.42)
  Target: x86_64-apple-darwin16.7.0
  Thread model: posix
  InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
   "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.cc -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 278.4 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0 -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/stephan -ferror-limit 19 -fmessage-length 132 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/q3/7lltvjlj4_l44qtq0fjz_slh0000gn/T/test-f1e908.o -x c++ test.cc
  clang -cc1 version 8.1.0 (clang-802.0.42) default target x86_64-apple-darwin16.7.0
  ignoring nonexistent directory "/usr/include/c++/v1"
  ignoring nonexistent directory "/usr/local/include"
  #include "..." search starts here:
  #include <...> search starts here:
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
   /usr/include
   /System/Library/Frameworks (framework directory)
   /Library/Frameworks (framework directory)
  End of search list.
   "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -o a.out /var/folders/q3/7lltvjlj4_l44qtq0fjz_slh0000gn/T/test-f1e908.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/lib/darwin/libclang_rt.osx.a
  Undefined symbols for architecture x86_64:
    "___cxa_deleted_virtual", referenced from:
        vtable for S in test-f1e908.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have no real idea what all these various files are used for, and which changes exactly are required and correct.  Just adding __cxa_deleted_virtual to all files in libcxx that already mentioned __cxa_pure_virtual and doing a fresh build fixed the issue for me on macOS (after fruitless attempts with changing only a subset of the files and/or doing an incremental rebuild).


https://reviews.llvm.org/D36870

Files:
  lib/abi/3.9/x86_64-apple-darwin16.abilist
  lib/abi/3.9/x86_64-linux-gnu.abilist
  lib/abi/4.0/x86_64-apple-darwin16.abilist
  lib/abi/4.0/x86_64-unknown-linux-gnu.abilist
  lib/abi/x86_64-apple-darwin16.abilist
  lib/abi/x86_64-unknown-linux-gnu.abilist
  lib/libc++abi.exp
  lib/libc++abi2.exp
  lib/libc++sjlj-abi.exp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36870.111653.patch
Type: text/x-patch
Size: 5187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/83e5d819/attachment.bin>


More information about the llvm-commits mailing list