coverage-reporting:  Add OP-TEE SPMC coverage support
diff --git a/coverage-tool/coverage-reporting/intermediate_layer.py b/coverage-tool/coverage-reporting/intermediate_layer.py
index be1fab7..701aeac 100644
--- a/coverage-tool/coverage-reporting/intermediate_layer.py
+++ b/coverage-tool/coverage-reporting/intermediate_layer.py
@@ -1,6 +1,6 @@
 # !/usr/bin/env python
 ###############################################################################
-# Copyright (c) 2020, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2022, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 ###############################################################################
@@ -384,7 +384,7 @@
         """
         command = "%s -Sl %s" % (OBJDUMP, elf_filename)
         dump = os_command(command)
-        dump += "\n"  # For pattern matching the last \n
+        dump += "\n0 <null>:"  # For pattern matching the last function
         elf_name = os.path.splitext(os.path.basename(elf_filename))[0]
         # Object that handles the function line numbers in
         # their filename
@@ -400,7 +400,7 @@
         # The function groups have 2 elements:
         # Function's block name, Function's block code
         function_groups = re.findall(
-            r"(?s)[0-9a-fA-F]+ <([a-zA-Z0-9_]+)>:\n(.+?)(?:\r*\n\n|\n$)",
+            r"(?s)[0-9a-fA-F]+ <([a-zA-Z0-9_]+)>:\n(.+?)(?=[A-Fa-f0-9]* <[a-zA-Z0-9_]+>:)",
             dump, re.DOTALL | re.MULTILINE)
         # Pointer to files dictionary
         source_files = self.source_files_coverage
@@ -598,7 +598,7 @@
 READELF = None
 FUNCTION_LINES_ENABLED = None
 SOURCE_PATTERN = (r'(?s)([a-zA-Z0-9_]+)?(?:\(\):\n)?(^/.+?):([0-9]+)'
-                  r'(?: \(.+?\))?\n(.+?)(?=\n/|\n$|([a-zA-Z0-9_]+\(\):))')
+                  r'(?: \(.+?\))?\n(.+?)(?=\n/|([a-zA-Z0-9_]+\(\):))')
 
 
 def main():