heguanhui opened a new pull request, #64241:
URL: https://github.com/apache/doris/pull/64241

   ## What problem does this PR solve?
   
   Issue Number: close #64239
   
   Problem Summary: When building BE unit tests in UBSAN mode, the linker 
reports undefined `_Unwind_*` symbols, causing the build to fail. The same 
issue also affects LSAN builds, and potentially ASAN and TSAN builds with Clang.
   
   The root cause is that the sanitizer link flags in `CMakeLists.txt` do not 
include `-lgcc_eh`, which provides the `_Unwind_*` family of symbols. These 
symbols are required by:
   
   1. `libclang_rt.ubsan_standalone` (references `_Unwind_Backtrace`, 
`_Unwind_GetIP`)
   2. `libprofiler.a` from gperftools (references `_Unwind_Backtrace`, 
`_Unwind_GetIP`)
   3. `libglog.a` (references `_Unwind_GetIP`)
   4. `libstdc++.a` (references `_Unwind_Resume`, `_Unwind_RaiseException`, 
`_Unwind_Resume_or_Rethrow`, `_Unwind_GetTextRelBase`, 
`_Unwind_GetRegionStart`, `_Unwind_GetDataRelBase`, `_Unwind_SetGR`, 
`_Unwind_SetIP`, `_Unwind_GetLanguageSpecificData`, `_Unwind_GetIPInfo`, 
`_Unwind_DeleteException`)
   
   For GCC builds, `-lgcc_eh` is added to `LSAN_LIBS` and `UBSAN_LIBS`. For 
Clang builds, `-lgcc_eh` is added to all sanitizer libs (`ASAN_LIBS`, 
`LSAN_LIBS`, `UBSAN_LIBS`, `TSAN_LIBS`) because when using 
`-rtlib=compiler-rt`, the compiler-rt runtime does not include unwind support 
by default.
   
   ## What is changed and how it works?
   
   In `be/CMakeLists.txt` and `cloud/CMakeLists.txt`:
   
   - GCC path: Add `-lgcc_eh` to `LSAN_LIBS` and `UBSAN_LIBS`
   - Clang path: Add `-lgcc_eh` to `ASAN_LIBS`, `LSAN_LIBS`, `UBSAN_LIBS`, and 
`TSAN_LIBS`
   
   ## Check List (For Author)
   
   - Test: Manual test
       - Built BE UT in UBSAN mode successfully after the fix
   - Behavior changed: No
   - Does this need documentation: No
   
   ## Check List (For Reviewer)
   
   - [ ] I have performed a self-review of my own code
   - [ ] I have commented my code, particularly in hard-to-understand areas
   - [ ] I have made corresponding changes to the documentation
   - [ ] I have added tests that prove my fix is effective or that my feature 
works
   - [ ] This PR will not break any existing functionality
   
   ## Release note
   
   None


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to