build: add -fno-delete-null-pointer-checks option

This patch adds `-fno-delete-null-pointer-checks` to RMM build.
This is added to disable a compiler optimization wherein it removes NULL
checks based on previous dereference to the pointer.

```
struct foo *s = bar->s;  /* initialize s with bar->s */

if (!bar)
    return -1;  /* if s is NULL, return error */
```

The compiler could optimize the NULL pointer check based on previous
dereference. In RMM, the first access would certainly crash, but if
RMM does manage to survive the crash due to some reason, then removal
of the NULL check by compiler is more problematic as it allows
the bug to propagate deeper into RMM.

The static analysis in RMM does prevent such problematic code patterns
but, following belt and braces approach for security,
this compiler optimization is also disabled by this patch.

The Release build of RMM is mostly identical with or without this
option and hence it is confirmation that RMM did not have such
problematic code pattern.

Change-Id: I4e2a8563a07f0d73b26d6a0f8618d20db7f8725d
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
diff --git a/toolchains/common.cmake b/toolchains/common.cmake
index 0d6d55f..1bd2b91 100644
--- a/toolchains/common.cmake
+++ b/toolchains/common.cmake
@@ -14,6 +14,7 @@
     string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-common ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-ffunction-sections ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-fdata-sections ")
+    string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-delete-null-pointer-checks ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-Wall -Werror -Wstrict-overflow ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-Wextra -Wno-implicit-fallthrough ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ")