Move dbus_to_terminus_effecter code to platform-mc
In the current state , pldm build breaks when attempting to perform
a debug-optimized build (`-O2` optimization), leading to the following
linker error:
```
undefined reference to `pldm::platform_mc::TerminusManager::getActiveEidByName
(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
```
This issue is not encountered in the CI environment, as CI uses the
`-Og` optimization flag, which does not aggressively inline functions.
Consequently, the reference to `getActiveEidByName()` is resolved
without issue. However, when building the project with default
optimizations (debugoptimized [-O2]), the build fails because the
linker cannot resolve the reference to `getActiveEidByName()`, which is
inlined by the compiler.
To address this problem, there are three potential solutions:
1. Prevent Inlining of the Function:
We could use `__attribute__((noinline))` to prevent the compiler
from inlining `getActiveEidByName()`.
2. Move Source Files into `libpldmresponder`:
We could move the `platform-mc/manager.cpp` and
`platform-mc/terminus_manager.cpp` files into the `libpldmresponder`
so the compiler can resolve the reference directly within the
library.
3. Migrate `dbus_to_terminus_effecter.cpp` to the `platform-mc` folder:
The most appropriate solution appears to be migrating the
`dbus_to_terminus_effecter.cpp` file into the `platform-mc` directory.
This file is not inherently tied to `libpldmresponder` but functions as
a requester. Additionally, there are existing community patches that
allow the system to scale from a single host terminus to multiple
terminii, further justifying this move. So, solution #3 is the most
fitting at this stage. By relocating the `dbus_to_terminus_effecter`
code to the `platform-mc` folder, we can ensure proper modularity,
while also resolving the build issue in a clean and scalable manner.
Tested By:
1. meson build -Doptimization=2 works fine with the patchset.
Change-Id: I0ac8be58253bfb0394500f1d34e8431c6103c924
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
diff --git a/host-bmc/test/meson.build b/host-bmc/test/meson.build
index 4ae286d..48e0b63 100644
--- a/host-bmc/test/meson.build
+++ b/host-bmc/test/meson.build
@@ -1,8 +1,3 @@
-host_bmc_test_src = declare_dependency(
- sources: ['../dbus_to_terminus_effecters.cpp'],
- include_directories: '../../requester',
-)
-
test_sources = [
'../../common/utils.cpp',
'../utils.cpp',
@@ -17,7 +12,7 @@
'../dbus/pcie_slot.cpp',
]
-tests = ['dbus_to_terminus_effecter_test', 'utils_test', 'custom_dbus_test']
+tests = ['utils_test', 'custom_dbus_test']
foreach t : tests
test(
@@ -30,7 +25,6 @@
dependencies: [
gtest,
gmock,
- host_bmc_test_src,
libpldm_dep,
libpldmutils,
nlohmann_json_dep,