scripts/symbolize.py: Support RISC-V architecture

If we get RISC-V architecture flag from ELF file, assign "self._arch" as
"riscv32-unknown-linux-gnu-" or "riscv64-unknown-linux-gnu-", since they
are prefixes of RISC-V's official toolchains.

Signed-off-by: Alvin Chang <alvinga@andestech.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
diff --git a/scripts/symbolize.py b/scripts/symbolize.py
index 7dbc533..e924de7 100755
--- a/scripts/symbolize.py
+++ b/scripts/symbolize.py
@@ -43,8 +43,8 @@
 variable is set, it is used as a prefix to the binutils tools. That is, the
 script will invoke $(CROSS_COMPILE)addr2line etc. If it is not set however,
 the prefix will be determined automatically for each ELF file based on its
-architecture (arm-linux-gnueabihf-, aarch64-linux-gnu-). The resulting command
-is then expected to be found in the user's PATH.
+architecture. The resulting command is then expected to be found in the user's
+PATH.
 
 OP-TEE abort and panic messages are sent to the secure console. They look like
 the following:
@@ -170,6 +170,11 @@
             self._arch = 'aarch64-linux-gnu-'
         elif b'ARM,' in output[0]:
             self._arch = 'arm-linux-gnueabihf-'
+        elif b'RISC-V,' in output[0]:
+            if b'32-bit' in output[0]:
+                self._arch = 'riscv32-unknown-linux-gnu-'
+            elif b'64-bit' in output[0]:
+                self._arch = 'riscv64-unknown-linux-gnu-'
 
     def arch_prefix(self, cmd, elf):
         self.set_arch(elf)