This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[OPCODES][AARCH64]Drop first symbol flavour check in print_insn_aarch64().

Hi all,

This is a simple patch to remove the flavour check on the first symbol in print_insn_aarch64().

It's a problem when the first symbol's flavour is not bfd_target_elf_flavour (and the target is elf). In my case, it's triggered in PLT section, with the first symbol being __tls_get_addr@plt. It's a synthetic symbol, bfd_target_unknown_flavour is returned. So the condition is always false. According to the code logic, it will not search the symbol table for proper mapping symbols, and the default mapping symbol(MAP_INSN) is always used.

For example, the following code:

    .word 0xeeff
    bl   __tls_get_addr
    .word 0xffee

After assemble, link, the objdump, the code is:

0000000000000280 <__tls_get_addr@plt-0x20>:
 280:   a9bf7bf0        stp     x16, x30, [sp,#-16]!
 284:   90000090        adrp    x16, 10000 <test+0xfd50>
 288:   f941e611        ldr     x17, [x16,#968]
 28c:   910f2210        add     x16, x16, #0x3c8
 290:   d61f0220        br      x17
 294:   d503201f        nop
 298:   d503201f        nop
 29c:   d503201f        nop

00000000000002a0 <__tls_get_addr@plt>:
 2a0:   90000090        adrp    x16, 10000 <test+0xfd50>
 2a4:   f941ea11        ldr     x17, [x16,#976]
 2a8:   910f4210        add     x16, x16, #0x3d0
 2ac:   d61f0220        br      x17

Disassembly of section .text:

00000000000002b0 <test>:
 2b0:   0000eeff        .inst   0x0000eeff ; undefined
 2b4:   97fffffb        bl      2a0 <__tls_get_addr@plt>
 2b8:   d503201f        nop
 2bc:   0000ffee        .inst   0x0000ffee ; undefined

As only elf target is implement in aarch64, this also makes the check redundant here.

binutils regression test Okay, is it fine to commit?


2015-09-15  Renlin Li  <>

    * aarch64-dis.c (print_insn_aarch64): Drop symbol flavour check.

diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 5fec4ee..2b2096f 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -2305,8 +2305,7 @@ print_insn_aarch64 (bfd_vma pc,
   /* First check the full symtab for a mapping symbol, even if there
      are no usable non-mapping symbols for this address.  */
-  if (info->symtab_size != 0
-      && bfd_asymbol_flavour (*info->symtab) == bfd_target_elf_flavour)
+  if (info->symtab_size != 0)
       enum map_type type = MAP_INSN;
       int last_sym = -1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]