[SWDEV-562726] Fix clang + ASAN errors

* Updates:
  - [ASAN] GCC does not support `-shared-libsan flags`, so removed this one
  - [Clang] Fixed refernces to local binding errors (name collision)
    & other strict scope/structure/lamda binding errors
  - [Clang] Fix rsmi_wrapper error: \"error: missing default argument on parameter \'args\'\"
  - [ASAN] Fixed stack-buffer-overflow found in
    `amdsmi_get_gpu_accelerator_partition_profile()`

Change-Id: I854007efb75d828dbb8088c0d56dbc125081f0f2
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
Charis Poag
2025-10-27 13:07:49 -05:00
committed by Arif, Maisam
parent ced7d12395
commit 00a04f5810
4 changed files with 48 additions and 58 deletions
+5 -3
View File
@@ -40,12 +40,14 @@ function(generic_package)
set(ASAN_LINKER_FLAGS "-fsanitize=address")
if(BUILD_SHARED_LIBS)
set(ASAN_COMPILER_FLAGS "${ASAN_COMPILER_FLAGS} -shared-libsan")
set(ASAN_LINKER_FLAGS "${ASAN_LINKER_FLAGS} -shared-libsan")
# Clang-specific flag for shared ASAN library
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(ASAN_COMPILER_FLAGS "${ASAN_COMPILER_FLAGS} -shared-libsan")
set(ASAN_LINKER_FLAGS "${ASAN_LINKER_FLAGS} -shared-libsan")
endif()
else()
set(ASAN_LINKER_FLAGS "${ASAN_LINKER_FLAGS} -static-libsan")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ASAN_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ASAN_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ASAN_LINKER_FLAGS}" PARENT_SCOPE)