Fix Compilation with DebugMode in Yocto arm sdk

- With d47f9a099a4ef992351237b0f2f562b5dc843397 being merged,
  we had enable all the security flags by default in openbmc.

- This has broken the pldm compilation in arm-sdk, as we default
  to debug mode(which does not have any optimization), and the
  FORTIFY_SOURCE only compiles with an optimization level {1,2}.

- We could not hit this problem till now beacuse both the dockerCI
  and also the yocto build bydefault overrides the buildtype to
  debugoptimized(which by default enables -O2).

- The intent behind this commit is to change the default buildtype
  to debugoptimized(-O2) from debug(-O2), as these are the yocto
  defaults & also make sure we can build pldm even in debug mode.

TestedBy:

1. With this patchset, was able to get a clean compilation in both
   debug & debugoptimized meson builds.

Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I910256c3aeffcbab0cbc33ced541b90576ce4151
diff --git a/meson.build b/meson.build
index 122323a..aee4c5e 100644
--- a/meson.build
+++ b/meson.build
@@ -4,7 +4,8 @@
           'warning_level=3',
           'default_library=shared',
           'werror=true',
-          'cpp_std=c++17'
+          'cpp_std=c++17',
+          'buildtype=debugoptimized'
         ])
 
 # Wno-psabi reduces the number of "Note:" messages when cross-compiling some STL
@@ -13,6 +14,13 @@
 # project uses the same compiler, we can safely ignmore these info notes.
 add_project_arguments('-Wno-psabi', language: 'cpp')
 
+
+# Disable FORTIFY_SOURCE when compiling with no optimization
+if(get_option('optimization') == '0')
+  add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
+  message('Disabling FORTIFY_SOURCE as optimization is set to 0')
+endif
+
 conf_data = configuration_data()
 conf_data.set_quoted('BIOS_JSONS_DIR', '/usr/share/pldm/bios')
 conf_data.set_quoted('BIOS_TABLES_DIR', '/var/lib/pldm/bios')