From dcaf4a292e4cd746497b03552b5d664ea69128ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Mollier?= Date: Sun, 27 Aug 2023 11:24:39 +0200 Subject: [PATCH] CMake - do not enforce -fPIE. When built with LTO enabled, the linking of liboam.so chokes on the following error, which is somewhat similar to the Debian bug #1030876 affecting PA-RISC, although the symptoms subtly differs in that it suggests to build using -fPIC: /usr/bin/ld: /tmp/cc0wF8Kx.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_ZTVSt9exception@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC The -fPIC argument is passed appropriately down to the build command, however it looks to be erased by the late introduction of -fPIE flag by upstream build system. Erasing this flag allows the build to go through, both with LTO and on PA-RISC. Bug: https://github.com/RadeonOpenCompute/rocm_smi_lib/issues/111 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1015653 Change-Id: I8b35fd4b62cfa1a9ddb145362464df5dd276e2f5 Signed-off-by: Galantsev, Dmitrii [ROCm/rocm_smi_lib commit: c4c19e79179d0895bfa82df71f307d334d8dd9d4] --- projects/rocm-smi-lib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/rocm-smi-lib/CMakeLists.txt b/projects/rocm-smi-lib/CMakeLists.txt index f5353608b1..6a9a003561 100755 --- a/projects/rocm-smi-lib/CMakeLists.txt +++ b/projects/rocm-smi-lib/CMakeLists.txt @@ -110,7 +110,7 @@ else () set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,noexecstack -Wl,-znoexecheap -Wl,-z,relro ") set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -Wtrampolines -Wl,-z,now -fPIE") + "${CMAKE_CXX_FLAGS} -Wtrampolines -Wl,-z,now") endif () # Use this instead of above for 32 bit