[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-12-04 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 added a comment. > ASan uses -Wl,-whole-archive to pull all its members Yep, I forgot about this. Looks like weak new/delete will do the job then. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54905/new/ https://reviews.llvm.org/D54905

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-12-03 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis added a comment. Linux linkers won't include a member of an archive only because it resolves a weak symbol, so in your example the answer is none. ASan uses -Wl,-whole-archive to pull all its members, this will resolve operator new to ASan definition unless there is another definition

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-12-02 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 added a comment. > don't think so. It's just symbol interposition. Every module in the process > gets the same definition. If I have two weak symbols in lib1.a and lib2.a and doesn't define strong one, which one will be chosen at link time? CHANGES SINCE LAST ACTION

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-30 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis added a comment. >> Would turning asan operator new/delete into weak symbols help? > > The new operator is already a weak symbol in libcxx, so it looks like an ODR > violation, doesn't it? I don't think so. It's just symbol interposition. Every module in the process gets the same

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-30 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 added a comment. > How do you do this now? Sometimes with this patch, sometimes simply issuing linker command line manually > Is that related to https://github.com/google/sanitizers/issues/295 ? I don't think so. I'm experiencing link error, not C++ standard discrepancy. > Would

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-29 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis added a comment. Our malloc definition is weak already, this will only change new/delete to match. This also makes the behaviour of static runtime consistent with the one of dynamic runtime where we can not prevent user from overloading operator new/delete. CHANGES SINCE LAST ACTION

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-29 Thread Kostya Serebryany via Phabricator via cfe-commits
kcc added a comment. weak new/delete may solve this particular problem, but may cause confusion to lots of other users, e.g. in cases when a user has overridden new/delete for non-essential reasons (e.g. debuging) and can disable the overrides in asan mode. With weak symbols such a user will

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-29 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis added a comment. Would turning asan operator new/delete into weak symbols help? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54905/new/ https://reviews.llvm.org/D54905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-29 Thread Kostya Serebryany via Phabricator via cfe-commits
kcc added a comment. In D54905#1312386 , @evgeny777 wrote: > Unfortunately, this is not an option. I have very custom heap implementation > (in fact multiple heap types sharing contiguous memory block), so ASAN heap > can't be a drop-in replacement. I'm

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-28 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 added a comment. Unfortunately, this is not an option. I have very custom heap implementation (in fact multiple heap types sharing contiguous memory block), so ASAN heap can't be a drop-in replacement. I'm using manual poisoning and it works pretty well, but have to disable C++

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-28 Thread Kostya Serebryany via Phabricator via cfe-commits
kcc added a comment. I am reluctant to add any new flags if there is any possibility to avoid doing so. Is there any other solution for your problem? E.g. you can disable the override of new/delete when building with asan. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54905/new/

[PATCH] D54905: [AddressSanitizer] Add flag to disable linking with CXX runtime

2018-11-26 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 created this revision. evgeny777 added reviewers: kcc, samsonov. This prevents link errors when operators new/delete are overridden by application. https://reviews.llvm.org/D54905 Files: include/clang/Driver/Options.td lib/Driver/SanitizerArgs.cpp test/Driver/sanitizer-ld.c