Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-27504

[RFE] [aarch64] Enhance objdump disassembly function references

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • None
    • None
    • None
    • None
    • rhel-sst-pt-gcc
    • ssg_platform_tools
    • 3
    • False
    • Hide

      None

      Show
      None
    • No
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • Unspecified Release Note Type - Unknown
    • aarch64
    • None

      What were you trying to do that didn't work?

      I am trying to analyze glibc's libc.so.6 using `objdump -d`. When a function passes a function (as a pointer) to another one, on x86_64 it shows the correct reference, but on aarch64 it does not.

      An example - the function __spawni, from glibc:sysdeps/unix/sysv/linux/spawni.c:

      /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
         Before running the process perform the actions described in FILE-ACTIONS. */
      int
      __spawni (pid_t * pid, const char *file,
                const posix_spawn_file_actions_t * acts,
                const posix_spawnattr_t * attrp, char *const argv[],
                char *const envp[], int xflags)
      {
        /* It uses __execvpex to avoid run ENOEXEC in non compatibility mode (it
           will be handled by maybe_script_execute).  */
        return __spawnix (pid, file, acts, attrp, argv, envp, xflags,
                          xflags & SPAWN_XFLAGS_USE_PATH ? __execvpex :__execve);
      }
      

      In x86_64, it correctly shows that this function references __execvpex and __execve:

      $ objdump -d --prefix-addresses x86_64/libc.so.6 | grep '^[^ ]* <__spawni\>'
      00000000000fc960 <__spawni> endbr64 
      00000000000fc964 <__spawni+0x4> sub    $0x8,%rsp
      00000000000fc968 <__spawni+0x8> lea    -0x230ff(%rip),%r11        # 00000000000d9870 <execve>
      00000000000fc96f <__spawni+0xf> lea    -0x225f6(%rip),%rax        # 00000000000da380 <__execvpex>
      00000000000fc976 <__spawni+0x16> mov    0x10(%rsp),%r10d
      00000000000fc97b <__spawni+0x1b> test   $0x1,%r10b
      00000000000fc97f <__spawni+0x1f> cmove  %r11,%rax
      00000000000fc983 <__spawni+0x23> push   %rax
      00000000000fc984 <__spawni+0x24> push   %r10
      00000000000fc986 <__spawni+0x26> callq  00000000000fc130 <__spawnix>
      00000000000fc98b <__spawni+0x2b> add    $0x18,%rsp
      00000000000fc98f <__spawni+0x2f> retq   
      

      But on aarch64, it does not:

      $ aarch64-linux-gnu-objdump -d --prefix-addresses aarch64/libc.so.6 | grep '^[^ ]* <__spawni\>'
      00000000000db844 <__spawni> tst x6, #0x1
      00000000000db848 <__spawni+0x4> adrp    x8, 00000000000bb000 <__run_prefork_handlers+0x14c>
      00000000000db84c <__spawni+0x8> adrp    x7, 00000000000bb000 <__run_prefork_handlers+0x14c>
      00000000000db850 <__spawni+0xc> add     x8, x8, #0x1c0
      00000000000db854 <__spawni+0x10> add    x7, x7, #0xd00
      00000000000db858 <__spawni+0x14> csel   x7, x7, x8, ne  // ne = any
      00000000000db85c <__spawni+0x18> b      00000000000db1e0 <__spawnix>
      

      Please provide the package NVR for which bug is seen:

      Tried RHEL8/9/Fedora38/39/rawhide's binutils - several versions between 2.30 and 2.42.

      How reproducible:

      Always

      Steps to reproduce

      See above

      Expected results

      Both output correct references

      Actual results

      x86_64 does, aarch64 does not.

      I personally tried only on x86_64, using aarch64-linux-gnu-objdump for the aarch64 binary. Someone tried for me the native objdump on aarch64 and the result was the same.

              nickc@redhat.com Nick Clifton
              rhn-support-ybardavi Yedidyah Bar David
              Nick Clifton Nick Clifton
              qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: