Define a function that asserts if called for MemalignFromLocalPool. This function is never called on Windows release builds because the 'if' condition that contains it is optimized away. It's presence breaks debug builds for asan_new_delete.cc, so something must define it to compile a debug build.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
lib/asan/asan_new_delete.cc | ||
---|---|---|
73 | I don't have an opinion on whether this fix is ok, but is the #ifdef correct here? Shouldn't it be #if defined(SANITIZER_WINDOWS) && defined(DEBUG) or #if SANITIZER_WINDOWS && DEBUG |
lib/asan/asan_new_delete.cc | ||
---|---|---|
73 | Looks like we check windoes as #if SANITIZER_WINDOWS and debug as #ifdef DEBUG |
And I don't see this code in the r346999
Could you please explain why you need to patch code which is not in the repo?
https://github.com/llvm-project/llvm-project-20170507/blob/master/compiler-rt/lib/asan/asan_new_delete.cc#L72
Does this depend on other patches?
Ah I think I see the issue. I uploaded a diff from my first version of the patch, rather than a clean diff from the master version. I'll fix this now.
Building debug will not succeed because of the undefined symbol, MemalignFromLocalPool. The idea was to define the symbol as nullptr, since the code path is never executed on Windows and is optimized away in Release builds. It occurs to me that a function that just asserts if it's called may be a better idea , rather than the dumb macro.
Fix debug builds by defining a Windows section of the OPERATOR_NEW_BODY macro with the MemalignFromLocalPool call and if condition removed. This section is dead code on Windows, anyway.
you can switch this patch into "Plan Changes" state
lib/asan/asan_new_delete.cc | ||
---|---|---|
76 | ALLOCATE_FROM_LOCAL_POOL is used for early allocations when asan is not initialized, so asan_memalign will not work. |
I don't see an option to do this, is there some permission needed to change the revision state from "Needs Review"?
lib/asan/asan_new_delete.cc | ||
---|---|---|
76 | It looks like ALLOCATE_FROM_LOCAL_POOL is statically defined and only really important on RTEMS, so this wouldn't matter here. The original definition is still below in the #else condition. This section is only for Windows. When running the test suite for this though, the debug build will complete with this fix. It will not successfully run the asan-check-dynamic suite though, so I need to figure out what's going wrong there. |
Should be in the "Add Action..." listbox in the bottom of the review page.
lib/asan/asan_new_delete.cc | ||
---|---|---|
76 | sgtm |
I don't have an opinion on whether this fix is ok, but is the #ifdef correct here? Shouldn't it be #if defined(SANITIZER_WINDOWS) && defined(DEBUG) or #if SANITIZER_WINDOWS && DEBUG