feat(fake_host):  Enable generating profile data

This patch adds necessary CFlags for generating the profiling
data when binary is executed. A grof file `gmon.out` is generated
when the fake_host binary is executed and it can be processed
using the gprof tool. A sample gprof cmd is shown below:

> gprof build/Debug/rmm.elf > prof.txt

The `fomit-frame-pointer` was not compatible with profiling options
hence this patch moves the option to make it AArch64 specific.
Also `-gdwarf-4` option is made common for fake_host and
AArch64.

Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: Id988e7fcb18048cc4d34ced3a339e73b116be786
diff --git a/toolchains/aarch64/common_aarch64.cmake b/toolchains/aarch64/common_aarch64.cmake
index 9d57304..4e58476 100644
--- a/toolchains/aarch64/common_aarch64.cmake
+++ b/toolchains/aarch64/common_aarch64.cmake
@@ -14,8 +14,8 @@
 	string(APPEND CMAKE_${language}_FLAGS_INIT "-march=armv8.5-a ")
 	string(APPEND CMAKE_${language}_FLAGS_INIT "-mgeneral-regs-only ")
 	string(APPEND CMAKE_${language}_FLAGS_INIT "-mstrict-align ")
+	string(APPEND CMAKE_${language}_FLAGS_INIT "-fomit-frame-pointer ")
 	string(APPEND CMAKE_${language}_FLAGS_INIT "-fpie ")
-	string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ")
 endforeach()
 
 string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib ")
diff --git a/toolchains/common.cmake b/toolchains/common.cmake
index 5270abe..a725f09 100644
--- a/toolchains/common.cmake
+++ b/toolchains/common.cmake
@@ -13,10 +13,10 @@
 
 foreach(language IN ITEMS ASM C CXX)
     string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-common ")
-    string(APPEND CMAKE_${language}_FLAGS_INIT "-fomit-frame-pointer ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-ffunction-sections ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-fdata-sections ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-Wall -Werror ")
+    string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ")
     string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og ")
     string(APPEND CMAKE_${language}_FLAGS_RELEASE_INIT "-g ")
 endforeach()
diff --git a/toolchains/fake_host/common_fake_host.cmake b/toolchains/fake_host/common_fake_host.cmake
new file mode 100644
index 0000000..a9821e8
--- /dev/null
+++ b/toolchains/fake_host/common_fake_host.cmake
@@ -0,0 +1,12 @@
+#
+# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
+#
+
+include_guard()
+
+include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake)
+
+foreach(language IN ITEMS ASM C CXX)
+    string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-omit-frame-pointer -pg ")
+endforeach()
diff --git a/toolchains/fake_host/gnu.cmake b/toolchains/fake_host/gnu.cmake
index 70a1c34..1f338fe 100644
--- a/toolchains/fake_host/gnu.cmake
+++ b/toolchains/fake_host/gnu.cmake
@@ -5,7 +5,7 @@
 
 include_guard()
 
-include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/common_fake_host.cmake)
 
 find_program(CMAKE_C_COMPILER
     NAMES "gcc"
diff --git a/toolchains/fake_host/llvm.cmake b/toolchains/fake_host/llvm.cmake
index b6564ae..96ff6f8 100644
--- a/toolchains/fake_host/llvm.cmake
+++ b/toolchains/fake_host/llvm.cmake
@@ -5,7 +5,7 @@
 
 include_guard()
 
-include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/common_fake_host.cmake)
 
 find_program(CMAKE_C_COMPILER
     NAMES "clang"