From a1b972177200b7191a33fc842d8a02ba72c6501d Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Mon, 14 Jun 2021 06:04:30 -0400 Subject: [PATCH] RHEL8.4: make mcinspect and eclair fPIE for RPM, clear build_ldflags in mckernel.spec Change-Id: I06f09628629c2afb0d36ad6ab2e2ed2cc716a980 --- executer/user/CMakeLists.txt | 4 ++++ scripts/mckernel.spec.in | 2 ++ 2 files changed, 6 insertions(+) diff --git a/executer/user/CMakeLists.txt b/executer/user/CMakeLists.txt index c53dc9d9..d7a0de9a 100644 --- a/executer/user/CMakeLists.txt +++ b/executer/user/CMakeLists.txt @@ -31,9 +31,13 @@ else() target_link_libraries(mcinspect ${LIBDWARF}) endif() target_link_libraries(mcinspect ${LIBBFD}) +set_property(TARGET mcinspect PROPERTY POSITION_INDEPENDENT_CODE ON) +set_property(TARGET mcinspect PROPERTY LINK_FLAGS "-fPIE -pie") add_executable(eclair eclair.c arch/${ARCH}/arch-eclair.c) target_link_libraries(eclair ${LIBBFD}) +set_property(TARGET eclair PROPERTY POSITION_INDEPENDENT_CODE ON) +set_property(TARGET eclair PROPERTY LINK_FLAGS "-fPIE -pie") add_library(sched_yield SHARED libsched_yield.c) target_link_libraries(sched_yield dl) diff --git a/scripts/mckernel.spec.in b/scripts/mckernel.spec.in index 3303d841..9d51c637 100644 --- a/scripts/mckernel.spec.in +++ b/scripts/mckernel.spec.in @@ -71,6 +71,8 @@ This package contains headers and libraries required for build apps using IHK/Mc # We need to remove ld flags like relro for the final mckernel.img link, as well as remove cflags for mckernel # ideally mckernel should use different environment variables for the user tools and the kernel tools altogether... +%undefine _hardened_build +%define build_ldflags "" %define __global_ldflags "" %define optflags -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic