From owner-freebsd-toolchain@freebsd.org Sat Sep 5 22:18:47 2020 Return-Path: Delivered-To: freebsd-toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99EE73D86B2 for ; Sat, 5 Sep 2020 22:18:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4BkTTg3bYTz45GL for ; Sat, 5 Sep 2020 22:18:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 796703D86B1; Sat, 5 Sep 2020 22:18:47 +0000 (UTC) Delivered-To: toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 782833D86B0 for ; Sat, 5 Sep 2020 22:18:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BkTTg2T9bz45ZK for ; Sat, 5 Sep 2020 22:18:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3521D2467E for ; Sat, 5 Sep 2020 22:18:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 085MIlRd084952 for ; Sat, 5 Sep 2020 22:18:47 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 085MIlTa084951 for toolchain@FreeBSD.org; Sat, 5 Sep 2020 22:18:47 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: toolchain@FreeBSD.org Subject: [Bug 249121] program compiled with -pg produces ld-elf abort Date: Sat, 05 Sep 2020 22:18:46 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: gnu X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: toolchain@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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-toolchain@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Sep 2020 22:18:47 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249121 Konstantin Belousov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dim@FreeBSD.org, | |emaste@freebsd.org --- Comment #4 from Konstantin Belousov --- Clang+lld produce very strange binary when all linked libraries are static: Elf file type is EXEC (Executable file) Entry point 0x2237a0 There are 11 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x0000000000000040 0x0000000000200040 0x0000000000200040 0x0000000000000268 0x0000000000000268 R 0x8 INTERP 0x00000000000002a8 0x00000000002002a8 0x00000000002002a8 0x0000000000000015 0x0000000000000015 R 0x1 [Requesting program interpreter: /libexec/ld-elf.so.1] LOAD 0x0000000000000000 0x0000000000200000 0x0000000000200000 0x000000000002279c 0x000000000002279c R 0x1000 LOAD 0x00000000000227a0 0x00000000002237a0 0x00000000002237a0 0x0000000000091760 0x0000000000091760 R E 0x1000 LOAD 0x00000000000b3f00 0x00000000002b5f00 0x00000000002b5f00 0x0000000000001898 0x0000000000001898 RW 0x1000 LOAD 0x00000000000b57a0 0x00000000002b87a0 0x00000000002b87a0 0x00000000000037c0 0x00000000002247a9 RW 0x1000 TLS 0x00000000000b3f00 0x00000000002b5f00 0x00000000002b5f00 0x0000000000001850 0x0000000000001870 R 0x10 GNU_RELRO 0x00000000000b3f00 0x00000000002b5f00 0x00000000002b5f00 0x0000000000001898 0x0000000000002100 R 0x1 GNU_EH_FRAME 0x000000000000fc80 0x000000000020fc80 0x000000000020fc80 0x000000000000300c 0x000000000000300c R 0x4 GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 0 NOTE 0x00000000000002c0 0x00000000002002c0 0x00000000002002c0 0x0000000000000048 0x0000000000000048 R 0x4 ... There is no dynamic section in this file. Relocation section with addend (.rela.dyn): r_offset r_info r_type st_value st_name + r_addend 0000002bbf50 000000000025 R_X86_64_IRELATIVE 0000000000000000 + 223dd0 0000002bbf58 000000000025 R_X86_64_IRELATIVE 0000000000000000 + 2a91e0 As you see, it specifies PHDR INTERP, which brings rtld into action. But there is no dynamic segment, so rtld cannot see any relocs, which resul= ts in the IRELATIVE relocation sites to still point to the resolver functions. This is arguably a bug in lld. There are also two bugs in rtld which fixes I will commit shortly. I assum= es dynamic segment is there and dereferences NULL pointer otherwise. Also, it terminates the image if there is no dynamic symbol table. --=20 You are receiving this mail because: You are the assignee for the bug.=