From c38463074e08a6443a283215d7899d71480715d0 Mon Sep 17 00:00:00 2001 From: Felix Willgerodt Date: Mon, 27 Feb 2023 13:01:06 +0000 Subject: [PATCH] Fix missing "Core was generated by" when loading a x32 corefile. --- bfd/ChangeLog | 5 +++++ bfd/elf64-x86-64.c | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 50e1e17ef4d..cac222cd564 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2023-02-27 Felix Willgerodt + + * elf64-x86-64.c (elf_x86_64_grok_psinfo): Check for + elf_external_linux_prpsinfo32_ugid32. + 2023-02-23 Fangrui Song * elfnn-riscv.c (struct riscv_elf_link_hash_table): Add params. diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index ef0ebdd6967..0aa9af5d8fc 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -389,7 +389,8 @@ elf_x86_64_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) default: return false; - case 124: /* sizeof(struct elf_prpsinfo) on Linux/x32 */ + case 124: + /* sizeof (struct elf_external_linux_prpsinfo32_ugid16). */ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 12); elf_tdata (abfd)->core->program @@ -398,7 +399,18 @@ elf_x86_64_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); break; - case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */ + case 128: + /* sizeof (struct elf_external_linux_prpsinfo32_ugid32). */ + elf_tdata (abfd)->core->pid + = bfd_get_32 (abfd, note->descdata + 12); + elf_tdata (abfd)->core->program + = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); + elf_tdata (abfd)->core->command + = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); + break; + + case 136: + /* sizeof (struct elf_prpsinfo) on Linux/x86_64. */ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24); elf_tdata (abfd)->core->program -- 2.30.2