[PATCH] D63280: [llvm-objdump] Use <first-symbol>-<offset> as the section start symbol

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 01:58:53 PDT 2019


peter.smith added a comment.

In D63280#1554470 <https://reviews.llvm.org/D63280#1554470>, @ychen wrote:

> To help writing up the discussion thread, I'm trying to gather some data on how each target handle the case with GNU objdump. Weird that I could not reproduce the results @MaskRay @peter.smith was able to obtain. This is not to show favor for either choice but to understand the current situation on GNU side so we make a sensible decision.


It looks like there was a fairly recent change in binutils, my version was 2.32. An older version I happen to have lying around 2.25, seems to match the behaviour you are seeing. If I had to guess I'd say it was this change in binutils: https://sourceware.org/bugzilla/show_bug.cgi?id=22911

>   ➜  Bld lsb_release -a
>   No LSB modules are available.
>   Distributor ID: Ubuntu
>   Description:    Ubuntu 18.04.2 LTS
>   Release:        18.04
>   Codename:       bionic
> 
> 
> risc-v
> 
>   ➜  Bld /usr/riscv64-linux-gnu/bin/objdump --version
>   GNU objdump (GNU Binutils for Ubuntu) 2.30
>   Copyright (C) 2018 Free Software Foundation, Inc.
>   This program is free software; you may redistribute it under the terms of
>   the GNU General Public License version 3 or (at your option) any later version.
>   This program has absolutely no warranty.
>   ➜  Bld file /usr/riscv64-linux-gnu/lib/libgomp.so.1.0.0
>   /usr/riscv64-linux-gnu/lib/libgomp.so.1.0.0: ELF 64-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, BuildID[sha1]=5af4a2eff63e94f36b40ad145b1c281908cfe8f9, stripped
>   ➜  Bld /usr/riscv64-linux-gnu/bin/objdump -d /usr/riscv64-linux-gnu/lib/libgomp.so.1.0.0 | head -n 20
>   
>   /usr/riscv64-linux-gnu/lib/libgomp.so.1.0.0:     file format elf64-littleriscv
>   
>   
>   Disassembly of section .plt:
>   
>   0000000000006dc0 <pthread_attr_setdetachstate at plt-0x20>:
>       6dc0:       00016397                auipc   t2,0x16
>       6dc4:       41c30333                sub     t1,t1,t3
>       6dc8:       4203be03                ld      t3,1056(t2) # 1d1e0 <acc_is_present_array_h_@@OACC_2.0+0x3046>
>       6dcc:       fd430313                addi    t1,t1,-44
>       6dd0:       42038293                addi    t0,t2,1056
>       6dd4:       00135313                srli    t1,t1,0x1
>       6dd8:       0082b283                ld      t0,8(t0)
>       6ddc:       000e0067                jr      t3
>   
>   0000000000006de0 <pthread_attr_setdetachstate at plt>:
>       6de0:       00016e17                auipc   t3,0x16
>       6de4:       410e3e03                ld      t3,1040(t3) # 1d1f0 <pthread_attr_setdetachstate at GLIBC_2.27>
>       6de8:       000e0367                jalr    t1,t3
>   
> 
> 
> aarch64
> 
>   ➜  Bld /usr/aarch64-linux-gnu/bin/objdump --version
>   GNU objdump (GNU Binutils for Ubuntu) 2.30
>   Copyright (C) 2018 Free Software Foundation, Inc.
>   This program is free software; you may redistribute it under the terms of
>   the GNU General Public License version 3 or (at your option) any later version.
>   This program has absolutely no warranty.
>   ➜  Bld file /usr/aarch64-linux-gnu/lib/libgomp.so.1.0.0
>   /usr/aarch64-linux-gnu/lib/libgomp.so.1.0.0: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=1106de22dfcbfbef7445bbcbe38479bcec8b8780, stripped
>   ➜  Bld /usr/aarch64-linux-gnu/bin/objdump -d /usr/aarch64-linux-gnu/lib/libgomp.so.1.0.0 | head -n 30
>   
>   /usr/aarch64-linux-gnu/lib/libgomp.so.1.0.0:     file format elf64-littleaarch64
>   
>   
>   Disassembly of section .init:
>   
>   0000000000006db8 <.init>:
>       6db8:       a9bf7bfd        stp     x29, x30, [sp, #-16]!
>       6dbc:       910003fd        mov     x29, sp
>       6dc0:       94000a77        bl      979c <acc_async_test_all at plt+0x246c>
>       6dc4:       a8c17bfd        ldp     x29, x30, [sp], #16
>       6dc8:       d65f03c0        ret
>   
>   Disassembly of section .plt:
>   
>   0000000000006dd0 <memcpy at plt-0x20>:
>       6dd0:       a9bf7bf0        stp     x16, x30, [sp, #-16]!
>       6dd4:       b00001b0        adrp    x16, 3b000 <acc_is_present_array_h_@@OACC_2.0+0x17a3c>
>       6dd8:       f947fe11        ldr     x17, [x16, #4088]
>       6ddc:       913fe210        add     x16, x16, #0xff8
>       6de0:       d61f0220        br      x17
>       6de4:       d503201f        nop
>       6de8:       d503201f        nop
>       6dec:       d503201f        nop
>   
>   0000000000006df0 <memcpy at plt>:
>       6df0:       d00001b0        adrp    x16, 3c000 <memcpy at GLIBC_2.17>
>       6df4:       f9400211        ldr     x17, [x16]
>       6df8:       91000210        add     x16, x16, #0x0
>       6dfc:       d61f0220        br      x17
> 
> 
> Test with GNU bintutils master branch just in case:
> 
>   ➜  Bld ~/Src/binutils-bld/binutils/objdump -d /usr/riscv64-linux-gnu/lib/libgomp.so.1.0.0 | head -n 20
>   
>   /usr/riscv64-linux-gnu/lib/libgomp.so.1.0.0:     file format elf64-littleriscv
>   
>   
>   Disassembly of section .plt:
>   
>   0000000000006dc0 <pthread_attr_setdetachstate at plt-0x20>:
>       6dc0:       00016397                auipc   t2,0x16
>       6dc4:       41c30333                sub     t1,t1,t3
>       6dc8:       4203be03                ld      t3,1056(t2) # 1d1e0 <acc_is_present_array_h_@@OACC_2.0+0x3046>
>       6dcc:       fd430313                addi    t1,t1,-44
>       6dd0:       42038293                addi    t0,t2,1056
>       6dd4:       00135313                srli    t1,t1,0x1
>       6dd8:       0082b283                ld      t0,8(t0)
>       6ddc:       000e0067                jr      t3
>   
>   0000000000006de0 <pthread_attr_setdetachstate at plt>:
>       6de0:       00016e17                auipc   t3,0x16
>       6de4:       410e3e03                ld      t3,1040(t3) # 1d1f0 <pthread_attr_setdetachstate at GLIBC_2.27>
>       6de8:       000e0367                jalr    t1,t3
>   
>   
>   ➜  Bld ~/Src/binutils-bld/binutils/objdump -d /usr/aarch64-linux-gnu/lib/libgomp.so.1.0.0 | head -n 30
>   
>   /usr/aarch64-linux-gnu/lib/libgomp.so.1.0.0:     file format elf64-littleaarch64
>   
>   
>   Disassembly of section .init:
>   
>   0000000000006db8 <.init>:
>       6db8:       a9bf7bfd        stp     x29, x30, [sp, #-16]!
>       6dbc:       910003fd        mov     x29, sp
>       6dc0:       94000a77        bl      979c <acc_async_test_all at plt+0x246c>
>       6dc4:       a8c17bfd        ldp     x29, x30, [sp], #16
>       6dc8:       d65f03c0        ret
>   
>   Disassembly of section .plt:
>   
>   0000000000006dd0 <memcpy at plt-0x20>:
>       6dd0:       a9bf7bf0        stp     x16, x30, [sp, #-16]!
>       6dd4:       b00001b0        adrp    x16, 3b000 <acc_is_present_array_h_@@OACC_2.0+0x17a3c>
>       6dd8:       f947fe11        ldr     x17, [x16, #4088]
>       6ddc:       913fe210        add     x16, x16, #0xff8
>       6de0:       d61f0220        br      x17
>       6de4:       d503201f        nop
>       6de8:       d503201f        nop
>       6dec:       d503201f        nop
>   
>   0000000000006df0 <memcpy at plt>:
>       6df0:       d00001b0        adrp    x16, 3c000 <memcpy at GLIBC_2.17>
>       6df4:       f9400211        ldr     x17, [x16]
>       6df8:       91000210        add     x16, x16, #0x0
>       6dfc:       d61f0220        br      x17




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63280/new/

https://reviews.llvm.org/D63280





More information about the llvm-commits mailing list