使用sanitize = vptr时未定义对__dynamic_cast的引用

问题描述

我用vfptr.cpp构建fsanitize=vptrstatic文件中。 它具有有关“未定义对__dynamic_cast的引用”的错误消息。 g ++ 7.4.0和g ++ 11.0.0都有问题。使用sanitizer = vptr是否合理?

vptr.cpp

struct A {
  virtual ~A() {};
};

int main() { A a; }

编译选项

g++ vptr.C -fsanitize=vptr -static

错误消息:

/usr/lib/gcc/x86_64-linux-gnu/7/libubsan.a(ubsan_type_hash_itanium.o): In function `isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*,__cxxabiv1::__class_type_info const*,long)':
(.text+0x52): undefined reference to `__dynamic_cast'
(.text+0x5e): undefined reference to `typeinfo for __cxxabiv1::__vmi_class_type_info'
(.text+0x6b): undefined reference to `__dynamic_cast'
/usr/lib/gcc/x86_64-linux-gnu/7/libubsan.a(ubsan_type_hash_itanium.o): In function `findBaseAtOffset(__cxxabiv1::__class_type_info const*,long)':
(.text+0x151): undefined reference to `__dynamic_cast'
(.text+0x15d): undefined reference to `typeinfo for __cxxabiv1::__vmi_class_type_info'
(.text+0x16a): undefined reference to `__dynamic_cast'
/usr/lib/gcc/x86_64-linux-gnu/7/libubsan.a(ubsan_type_hash_itanium.o): In function `__ubsan::checkDynamicType(void*,void*,unsigned long)':
(.text+0x293): undefined reference to `__dynamic_cast'
collect2: error: ld returned 1 exit status

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)