From 5ce7e79f2ceaf35d0a2accd0a5f8bf2a38480cb3 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 22 Feb 2018 13:07:08 -0500
Subject: [PATCH] P4 to Git Change 1518310 by msearles@zuni-1666 on 2018/02/22
13:02:34
SWDEV-102733 - Update some CMakeLists.txt files:
- when setting CMAKE_CXX_FLAGS, append to it rather than overwriting it.
- some linker flags, -Wl,--unresolved-symbols=report-all being one of them, requires -shared-libasan if using -fsanitize=address.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/CMakeLists.txt#13 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/CMakeLists.txt#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/CMakeLists.txt#9 edit
... //depot/stg/opencl/drivers/opencl/tools/clinfo/CMakeLists.txt#5 edit
[ROCm/clr commit: 23ba7de5ccd79cc30a14bd56ab8d1c492e9a0057]
---
projects/clr/opencl/api/opencl/amdocl/CMakeLists.txt | 9 ++++++++-
projects/clr/opencl/tools/clinfo/CMakeLists.txt | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/projects/clr/opencl/api/opencl/amdocl/CMakeLists.txt b/projects/clr/opencl/api/opencl/amdocl/CMakeLists.txt
index 598650a92d..25d6473637 100644
--- a/projects/clr/opencl/api/opencl/amdocl/CMakeLists.txt
+++ b/projects/clr/opencl/api/opencl/amdocl/CMakeLists.txt
@@ -1,4 +1,11 @@
-set(CMAKE_CXX_FLAGS "-std=c++11")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+
+# Some linker flags, -Wl,--unresolved-symbols=report-all being one of them, requires -shared-libasan if using -fsanitize=address.
+# If -Wl,--unresolved-symbols=report-all is removed from CMAKE_SHARED_LINKER_FLAGS, then update this snippet
+if(CMAKE_CXX_FLAGS MATCHES "fsanitize=address")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -shared-libasan")
+endif()
+
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic -Wl,--unresolved-symbols=report-all -Wl,--version-script=${CMAKE_SOURCE_DIR}/api/opencl/amdocl/amdocl.map")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
diff --git a/projects/clr/opencl/tools/clinfo/CMakeLists.txt b/projects/clr/opencl/tools/clinfo/CMakeLists.txt
index 85012eae0a..974a46fa95 100644
--- a/projects/clr/opencl/tools/clinfo/CMakeLists.txt
+++ b/projects/clr/opencl/tools/clinfo/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(CMAKE_CXX_FLAGS "-std=c++11")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)