From 2740652fdb5f85d593e43a7dfea7af8c513aee93 Mon Sep 17 00:00:00 2001 From: Yogesh Tyagi Date: Fri, 12 Sep 2025 10:48:16 +0800 Subject: ipmctl: fix build issue undefined reference to `main` - `-pie` is only valid when linking executables (PIE), not shared libraries. So remove `-pie` from shared libraries linker flag. Signed-off-by: Yogesh Tyagi Signed-off-by: Anuj Mittal --- ...fix-build-failure-by-removing-pie-from-sh.patch | 39 ++++++++++++++++++++++ .../recipes-support/ipmctl/ipmctl_03.00.00.0499.bb | 1 + 2 files changed, 40 insertions(+) create mode 100644 dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-fix-build-failure-by-removing-pie-from-sh.patch diff --git a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-fix-build-failure-by-removing-pie-from-sh.patch b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-fix-build-failure-by-removing-pie-from-sh.patch new file mode 100644 index 00000000..3545cd5e --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-fix-build-failure-by-removing-pie-from-sh.patch @@ -0,0 +1,39 @@ +From 5b8b59a18f4a54ba912faad861f0af3fdcf127c6 Mon Sep 17 00:00:00 2001 +From: Yogesh Tyagi +Date: Wed, 10 Sep 2025 21:15:53 +0800 +Subject: [PATCH] CMakeLists: fix build failure by removing -pie from shared + library targets + +With CMake 4.1.0 the build of libipmctl started failing with: + + error: undefined reference to `main` in *.S + +- `-pie` is only valid when linking executables (PIE), not shared + libraries. +- When applied to a shared library, the linker expects a `main` + symbol, causing the undefined reference error. +- Remove `-pie` from shared libraries linker flag + +Upstream-Status: Submitted [https://github.com/intel/ipmctl/pull/221] + +Signed-off-by: Yogesh Tyagi +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1c07e682..d7aab78f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -156,7 +156,7 @@ endif() + if(UNIX) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_MSABI_VA_FUNCS -std=c99 -Wformat -Wformat-security -D_XOPEN_SOURCE=500 -Wall -Wfatal-errors -MMD -fPIC -fno-strict-aliasing") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wformat -Wformat-security -D_XOPEN_SOURCE=500 -Drestrict=__restrict__ -Wall -Wfatal-errors -MMD -fPIC -fno-strict-aliasing") +- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now -pie") ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now") + elseif(MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /GS /DynamicBase /sdl") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS /DynamicBase /sdl") +-- +2.37.3 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0499.bb b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0499.bb index eec0f8b5..a0877071 100644 --- a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0499.bb +++ b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0499.bb @@ -19,6 +19,7 @@ SRC_URI = "git://github.com/intel/ipmctl.git;protocol=https;branch=master_3_0;na git://github.com/tianocore/edk2.git;protocol=https;name=edk2;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/edk2;branch=master \ file://0001-Ignore-STATIC_ASSERTs-and-NULL-define-for-os-and-ut-builds.patch;patchdir=edk2 \ file://0001-CMakeLists-disable-Werror.patch \ + file://0001-CMakeLists-fix-build-failure-by-removing-pie-from-sh.patch \ " SRCREV_ipmctl = "a71f2fb1c90dd07f9862b71c789881132193e8f9" -- cgit v1.2.3-54-g00ecf