This changes fix the tests for Darwin. I forgot to filter the symbols with "TWw". Also I filter __sanitizer_mz*.
If fact it would be better if we could use: nm -D instead of nm -g. (we do that on linux in interface_symbol_linux.c test) Is only outdated or we can not use -D on Darwin? Could you check?
Thanks!
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This fails with
=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files. 173d172 < __sanitizer_free_hook 187d185 < __sanitizer_malloc_hook 200,203d197 < __sanitizer_symbolize_code < __sanitizer_symbolize_data < __sanitizer_symbolize_demangle < __sanitizer_symbolize_flush
In linux: nm -g lib/clang/5.0.0/lib/linux/libclang_rt.asan-x86_64.so | grep malloc_hook , outputs:
w __sanitizer_malloc_hook
So, it looks like it is omitted in Darwin. I guess nm is ignoring weak symbols that doesn't provide a default implementation.
I can modify the tests to ignore weak symbols, and only check non-weak symbols, as the original test.
On macOS, nm -gm shows weak symbols:
$ nm -g $(pwd)/lib/clang/4.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib ... 0000000000077b10 (__TEXT,__text) external ___sanitizer_symbolize_pc ... (undefined) weak external ___ubsan_default_options (dynamically looked up) ...
Btw, the current status of the patch fails with:
=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files. 6a7,8 > __asan_default_options > __asan_default_suppressions 49a52 > __asan_on_error 143a147 > __sancov_default_options 151a156,162 > __sanitizer_cov_trace_cmp > __sanitizer_cov_trace_cmp1 > __sanitizer_cov_trace_cmp2 > __sanitizer_cov_trace_cmp4 > __sanitizer_cov_trace_cmp8 > __sanitizer_cov_trace_div4 > __sanitizer_cov_trace_div8 152a164,168 > __sanitizer_cov_trace_gep > __sanitizer_cov_trace_pc_guard > __sanitizer_cov_trace_pc_guard_init > __sanitizer_cov_trace_pc_indir > __sanitizer_cov_trace_switch 170a187 > __sanitizer_print_memory_profile 173a191 > __sanitizer_report_error_summary 174a193 > __sanitizer_sandbox_on_notify 188a208 > __ubsan_default_options
test/asan/TestCases/Darwin/interface_symbols_darwin.c | ||
---|---|---|
16 ↗ | (On Diff #86487) | Sigh. I hoped we could also check weak exports. |
@kubamracek Ok, it looks like nm in Darwin tags weak symbols with a default implementation as T , while in linux they are tagged as W . Because of that the last diff failed.
Ok, so the problem are the weak symbols that doesn't have a default implementation, like __sanitizer_*_hook . nm in Darwin doesn't show them. (This is what I understand from here). Probably they are listed with a different letter (not with T ). Could you check this:
nm -g $(pwd)/lib/clang/4.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib | grep sanitizer_malloc_hook
$ nm -g $(pwd)/lib/clang/4.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib | grep sanitizer_malloc_hook U ___sanitizer_malloc_hook $
Ok, in http://lab.llvm.org:8080/green//job/clang-stage2-configure-Rlto_check/12345/consoleFull#-6058682498254eaf0-7326-4999-85b0-388101f2d404
I can see, also the symbols:
> __ubsan_handle_dynamic_type_cache_miss > __ubsan_handle_dynamic_type_cache_miss_abort
Are missing, because they are only included when SANITIZER_CAN_USE_CXXABI is true. So, I will ommit them in the test.