bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/25940] ld.bfd, clang’s ubsan, shared libraries, and virtual tabl


From: dilyan.palauzov at aegee dot org
Subject: [Bug ld/25940] ld.bfd, clang’s ubsan, shared libraries, and virtual tables do not work together
Date: Fri, 08 May 2020 20:41:18 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25940

--- Comment #4 from dilyan.palauzov at aegee dot org <dilyan.palauzov at aegee 
dot org> ---
I created one more file, b.cpp:

extern "C" {
void y();
}

int main() {
  y();
}

It differs from b.c only in the file extension and y() is under “extern "C"”.

Doing the iterations with z.cpp and e.cpp, but replacing the executable source
from b.c to b.cpp makes all ubsan warning disappear, except:

input z clang linker gold sanitizer address
/usr/local/bin/ld.gold: warning: Cannot export local symbol
'__asan_extra_spill_area'

To sum up, when a DSO is written in C++ and does class conversions, then the
DSO has at the end undefined symbols “__ubsan_vptr_type_cache” and
“`__ubsan_handle_dynamic_type_cache_miss”.  These symbols are resolved by
clang++, when the DSO is linked towards a C++ code, but not resolved by clang
(withouth ++) when the DSO is linked towards C code.  Moreover, ld.bfd report
problem a problem at link time, while with gold and lld the report is at
runtime. 

With the address sanitizer and clang, gold reports one additional warning,
which cause I cannot figure out.

So why does the linker resolve “__ubsan_vptr_type_cache” and
“`__ubsan_handle_dynamic_type_cache_miss” when it is called from clang++, but
not when called from clang? It is valid to link a DSO with extern "C" exported
functions with a .c code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]