From owner-freebsd-bugs@freebsd.org Fri May 11 17:22:11 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B022FAD08C for ; Fri, 11 May 2018 17:22:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 326997D799 for ; Fri, 11 May 2018 17:22:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id E2FA5FAD089; Fri, 11 May 2018 17:22:10 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB858FAD088 for ; Fri, 11 May 2018 17:22:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 397BC7D791 for ; Fri, 11 May 2018 17:22:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 7ED1156C8 for ; Fri, 11 May 2018 17:22:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w4BHM9Mp061136 for ; Fri, 11 May 2018 17:22:09 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w4BHM9Gc061135 for bugs@FreeBSD.org; Fri, 11 May 2018 17:22:09 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 227552] w, uptime i386 coredump in libxo Date: Fri, 11 May 2018 17:22:08 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: phil@freebsd.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2018 17:22:11 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D227552 --- Comment #24 from Phil Shafer --- I'm looking into why readelf output differs between the stripped and unstri= pped versions of the library, per comment #20. readelf.c:2381 has the following code: 2371 printf("\n Section to Segment mapping:\n"); 2372 printf(" Segment Sections...\n"); 2373 for (i =3D 0; (size_t)i < phnum; i++) { 2374 if (gelf_getphdr(re->elf, i, &phdr) !=3D &phdr) { 2375 warnx("gelf_getphdr failed: %s", elf_errmsg(-1)); 2376 continue; 2377 } 2378 printf(" %2.2d ", i); 2379 /* skip NULL section. */ 2380 for (j =3D 1; (size_t)j < re->shnum; j++) 2381 if (re->sl[j].addr >=3D phdr.p_vaddr && 2382 re->sl[j].addr + re->sl[j].sz <=3D 2383 phdr.p_vaddr + phdr.p_memsz) 2384 printf("%s ", re->sl[j].name); 2385 printf("\n"); For the unstripped library, the output is: Section to Segment mapping: Segment Sections... 00 .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.= dyn .rel.plt .init .plt .text .fini .rodata .eh_frame .comment .debug_pubnames .debug_info .debug_abbrev .debug_line .debug_frame .debug_str .debug_loc .debug_macinfo .debug_pubtypes .debug_ranges .shstrtab .symtab .strtab 01 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss 02 .dynamic 03 .tbss .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss 04 where the stripped library says: Section to Segment mapping: Segment Sections... 00 .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.= dyn .rel.plt .init .plt .text .fini .rodata .eh_frame .comment .shstrtab 01 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss 02 .dynamic 03 .bss 04 So I breakpointed on line 2381 when i =3D=3D 3 and j =3D=3D 15. For the unstripped library (the working one): (gdb) p re->sl[j] $18 =3D {name =3D 0x28626087 ".tbss", scn =3D 0x28621780, off =3D 94712, sz= =3D 1624, entsize =3D 0, align =3D 8, type =3D 8, flags =3D 1027, addr =3D 98808, link =3D 0, info= =3D 0} (gdb) p phdr $19 =3D {p_type =3D 7, p_flags =3D 4, p_offset =3D 94712, p_vaddr =3D 98808= , p_paddr =3D 98808, p_filesz =3D 0, p_memsz =3D 1624, p_align =3D 8} (gdb) p (re->sl[j].addr >=3D phdr.p_vaddr) $20 =3D 1 (gdb) p (re->sl[j].addr + re->sl[j].sz <=3D phdr.p_vaddr + phdr.p_memsz) $21 =3D 1 Both conditions are true. For the stripped library (the failing one): (gdb) p re->sl[j] $13 =3D {name =3D 0x28621077 ".tbss", scn =3D 0x2861d780, off =3D 94712, sz= =3D 1624, entsize =3D 0, align =3D 8, type =3D 8, flags =3D 1027, addr =3D 98808, link =3D 0, info= =3D 0} (gdb) p phdr $15 =3D {p_type =3D 7, p_flags =3D 4, p_offset =3D 94712, p_vaddr =3D 10034= 0, p_paddr =3D 100340, p_filesz =3D 0, p_memsz =3D 80, p_align =3D 8} (gdb) p (re->sl[j].addr >=3D phdr.p_vaddr) $14 =3D 0 The section's address (98808) is less than the segment's (100340), so the section is no longer listed. Perhaps is strip not updating the addresses as it removes sections? Or is there a disagreement between clang-6 and binutils about elf layout? Thanks, Phil --=20 You are receiving this mail because: You are the assignee for the bug.=