[PATCH v2 2/2] opcodes/nfp: skip those non-code sections

Yinjun Zhang yinjun.zhang@corigine.com
Thu Aug 26 01:01:18 GMT 2021


Currently nfp disassemblers can only support code section,
and we don't require to disassmeble other sections for now.
So skip the non-code sections.

Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 opcodes/nfp-dis.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/opcodes/nfp-dis.c b/opcodes/nfp-dis.c
index ff69410d967..05f7a27bc46 100644
--- a/opcodes/nfp-dis.c
+++ b/opcodes/nfp-dis.c
@@ -2959,6 +2959,14 @@ print_insn_nfp (bfd_vma addr, struct disassemble_info *dinfo)
   nfp_opts opts;
   int err;
 
+  /* Currently only disassemble the text section.  */
+  if (!(dinfo->section->flags & SEC_CODE))
+    {
+      dinfo->fprintf_func (dinfo->stream,
+			   "Disassembly of this section is not supported\t # SKIP");
+      return -1;
+    }
+
   opts.show_pc = 1;
   opts.ctx_mode = 0;
   err = parse_disassembler_options (&opts, dinfo);
-- 
2.27.0



More information about the Binutils mailing list