From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6486 invoked by alias); 28 Jul 2007 19:51:52 -0000 Received: (qmail 6475 invoked by uid 22791); 28 Jul 2007 19:51:51 -0000 X-Spam-Check-By: sourceware.org Received: from pauline.vellum.cz (HELO pauline.vellum.cz) (89.250.243.234) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 28 Jul 2007 19:51:46 +0000 Received: from host0.dyn.jankratochvil.net (localhost.localdomain [127.0.0.1]) by pauline.vellum.cz (8.12.11.20060308/8.12.11) with ESMTP id l6SJpgoH019868 for ; Sat, 28 Jul 2007 21:51:42 +0200 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.1/8.13.8) with ESMTP id l6SJnCjV015570 for ; Sat, 28 Jul 2007 21:49:12 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.1/8.14.1/Submit) id l6SJnCkp015569 for binutils@sources.redhat.com; Sat, 28 Jul 2007 21:49:12 +0200 Resent-From: jan.kratochvil@redhat.com Resent-Date: Sat, 28 Jul 2007 21:49:12 +0200 Resent-Message-ID: <20070728194912.GA15564@host0.dyn.jankratochvil.net> Resent-To: binutils@sources.redhat.com Date: Sat, 28 Jul 2007 20:16:00 -0000 From: Jan Kratochvil To: binutils@sources.redhat.com Cc: Roland McGrath Subject: [patch] bfd: Core files with p_filesz < p_memsz (build-id) Message-ID: <20070728191354.GA14892@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jI8keyz6grp/JLjh" Content-Disposition: inline User-Agent: Mutt/1.5.14 (2007-02-12) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00516.txt.bz2 <<< No Message Collected >>> --jI8keyz6grp/JLjh-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7008 invoked by alias); 28 Jul 2007 19:51:58 -0000 Received: (qmail 6999 invoked by uid 22791); 28 Jul 2007 19:51:57 -0000 X-Spam-Check-By: sourceware.org Received: from pauline.vellum.cz (HELO pauline.vellum.cz) (89.250.243.234) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 28 Jul 2007 19:51:55 +0000 Received: from host0.dyn.jankratochvil.net (localhost.localdomain [127.0.0.1]) by pauline.vellum.cz (8.12.11.20060308/8.12.11) with ESMTP id l6SJpqCT019876 for ; Sat, 28 Jul 2007 21:51:52 +0200 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.1/8.13.8) with ESMTP id l6SJpqai015701 for ; Sat, 28 Jul 2007 21:51:52 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.1/8.14.1/Submit) id l6SJpq7e015700 for binutils@sources.redhat.com; Sat, 28 Jul 2007 21:51:52 +0200 Resent-From: jan.kratochvil@redhat.com Resent-Date: Sat, 28 Jul 2007 21:51:52 +0200 Resent-Message-ID: <20070728195152.GA15698@host0.dyn.jankratochvil.net> Resent-To: binutils@sources.redhat.com Date: Sun, 29 Jul 2007 12:30:00 -0000 From: Jan Kratochvil To: binutils@sources.redhat.com Cc: Roland McGrath Subject: [patch] bfd: Core files with p_filesz < p_memsz (build-id) Message-ID: <20070728191354.GA14892@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jI8keyz6grp/JLjh" Content-Disposition: inline User-Agent: Mutt/1.5.14 (2007-02-12) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00517.txt.bz2 Message-ID: <20070729123000.TpYsBuod6kkfUIGCQmuLW_uI0g35iz_hhN_ntOEZ1YQ@z> --jI8keyz6grp/JLjh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 2217 Hi, there is now a pending patch for Linux kernels producing core files with the first page of the ELF file for the build-id note identification. So far BFD handled either p_filesz == 0 or p_filesz == p_memsz. Patch handles the case 0 < p_filesz < p_memsz (p_filesz == PAGE_SIZE for the build-id case). `0 < p_filesz < p_memsz' meaning was so far undefined for the ET_CORE files. Regards, Jan New build-id enhanced Linux kernels produce core files: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align NOTE 0x000660 0x0000000000000000 0x0000000000000000 0x000324 0x000000 0x0 LOAD 0x001000 0x0000000000400000 0x0000000000000000 0x001000 0x0b1000 R E 0x1000 ^^^^^^^^ ^^^^^^^^ LOAD 0x002000 0x00000000006b1000 0x0000000000000000 0x00a000 0x00a000 RW 0x1000 BFD-patched gdb `info files' 0x0000000000400000 - 0x0000000000401000 is load1 0x00000000006b1000 - 0x00000000006bb000 is load2 0x0000000000419f00 : push %r15 0x0000000000419f02 : push %r14 BROKEN: original gdb `info files' (it sees the code sections zeroed) 0x0000000000400000 - 0x0000000000401000 is load1a 0x0000000000401000 - 0x00000000004b1000 is load1b ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0x00000000006b1000 - 0x00000000006bb000 is load2 0x0000000000419f00 : add %al,(%rax) 0x0000000000419f02 : add %al,(%rax) (as 0x419f00 >= 0x401000) Legacy kernel core files: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align NOTE 0x000660 0x0000000000000000 0x0000000000000000 0x000324 0x000000 0x0 LOAD 0x001000 0x0000000000400000 0x0000000000000000 0x000000 0x0b1000 R E 0x1000 ^^^^^^^^ ^^^^^^^^ LOAD 0x001000 0x00000000006b1000 0x0000000000000000 0x00a000 0x00a000 RW 0x1000 original gdb `info files' 0x00000000006b1000 - 0x00000000006bb000 is load2 0x0000000000419f00 : push %r15 0x0000000000419f02 : push %r14 --jI8keyz6grp/JLjh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="bfd-dump_elf_headers.patch" Content-length: 1055 2007-07-28 Jan Kratochvil * bfd/elf.c (_bfd_elf_new_section_hook): New comment for ET_CORE files with p_filesz shorter than p_memsz. The data/bss split case has been restricted only for non-ET_CORE files. --- bfd/elf.c 26 Jul 2007 18:15:46 -0000 1.401 +++ bfd/elf.c 28 Jul 2007 19:00:08 -0000 @@ -2225,6 +2225,9 @@ _bfd_elf_new_section_hook (bfd *abfd, as by the difference between the two sizes. In effect, the segment is split into it's initialized and uninitialized parts. + This notion does not apply in ET_CORE files, where a shorter p_filesz means + that the data is not available in the dump. + */ bfd_boolean @@ -2239,8 +2242,8 @@ _bfd_elf_make_section_from_phdr (bfd *ab size_t len; int split; - split = ((hdr->p_memsz > 0) - && (hdr->p_filesz > 0) + split = (abfd->format != bfd_core + && (hdr->p_memsz > 0) && (hdr->p_filesz > 0) && (hdr->p_memsz > hdr->p_filesz)); sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : ""); len = strlen (namebuf) + 1; --jI8keyz6grp/JLjh--