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/platform-mc/test/meson.build b/platform-mc/test/meson.build
index e8ea6b7..2d722e9 100644
--- a/platform-mc/test/meson.build
+++ b/platform-mc/test/meson.build
@@ -8,6 +8,7 @@
'../sensor_manager.cpp',
'../numeric_sensor.cpp',
'../event_manager.cpp',
+ '../dbus_to_terminus_effecters.cpp',
'../../requester/mctp_endpoint_discovery.cpp',
],
include_directories: ['../../requester', '../../pldmd'],
@@ -20,6 +21,7 @@
'sensor_manager_test',
'numeric_sensor_test',
'event_manager_test',
+ 'dbus_to_terminus_effecter_test',
]
foreach t : tests