bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/24643] New: arm/aarch64: SEGV in objdump -ld for static pr


From: adam at os dot inf.tu-dresden.de
Subject: [Bug binutils/24643] New: arm/aarch64: SEGV in objdump -ld for static programs with split out debug symbols
Date: Thu, 06 Jun 2019 20:11:58 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=24643

            Bug ID: 24643
           Summary: arm/aarch64: SEGV in objdump -ld for static programs
                    with split out debug symbols
           Product: binutils
           Version: 2.33 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: adam at os dot inf.tu-dresden.de
  Target Milestone: ---

Created attachment 11816
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11816&action=edit
Patch to fix segfault

Hi,

objdump segfaults when using split out debug symbols and static programs on arm
and aarch64:

$ cat sh.sh 
echo 'int main() { return 0; }' > foo.c
set -x
aarch64-linux-gnu-gcc -static -o foo-arm64 foo.c
objcopy --only-keep-debug foo-arm64 foo-arm64.debug
objcopy --strip-unneeded foo-arm64
objcopy --add-gnu-debuglink=foo-arm64.debug foo-arm64
objdump -ld foo-arm64

arm-linux-gnueabihf-gcc -static -o foo-arm32 foo.c
objcopy --only-keep-debug foo-arm32 foo-arm32.debug
objcopy --strip-unneeded foo-arm32
objcopy --add-gnu-debuglink=foo-arm32.debug foo-arm32
objdump -ld foo-arm32


$ sh sh.sh
+ aarch64-linux-gnu-gcc -static -o foo-arm64 foo.c
+ objcopy --only-keep-debug foo-arm64 foo-arm64.debug
+ objcopy --strip-unneeded foo-arm64
+ objcopy --add-gnu-debuglink=foo-arm64.debug foo-arm64
+ objdump -ld foo-arm64

foo-arm64:     file format elf64-littleaarch64


Disassembly of section .init:

00000000004001d8 <.init>:
sh.sh: line 7: 31282 Segmentation fault      objdump -ld foo-arm64
+ arm-linux-gnueabihf-gcc -static -o foo-arm32 foo.c
+ objcopy --only-keep-debug foo-arm32 foo-arm32.debug
+ objcopy --strip-unneeded foo-arm32
+ objcopy --add-gnu-debuglink=foo-arm32.debug foo-arm32
+ objdump -ld foo-arm32

foo-arm32:     file format elf32-littlearm


Disassembly of section .init:

00010140 <.init>:
sh.sh: line 13: 31291 Segmentation fault      objdump -ld foo-arm32
$

Problem seems to be that aarch64_elf_find_function/arm_elf_find_function get
their symbols argument with NULL which the function is not prepared to handle.
Adding a check for NULL makes it work, see attached patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]