From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C52613858CD1; Thu, 22 Feb 2024 18:44:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C52613858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1708627446; bh=YSbioptOhylXuqTAKHJtDmPn4VjYBiNX9tQXH/0k8a4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=p5QLNk50qARdE4RVJaUdSFwjDfX/9eXybpPUUIDRdv73FIo5ovOJJ7LDvHbR5pLY3 /OaLv/vW3u5/XU4J5+9Ksr9dnsBg5xnJPiR/L6w/G6FvTYxoxDDVAnOO/DF731DUEn iOnt4nxVKrqZa8nTKpDW/2flNDxnZM/tML4zdw7k= From: "palmer at gcc dot gnu.org" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/31317] [RISCV] static PIE crashes during self relocation Date: Thu, 22 Feb 2024 18:44:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.39 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: palmer at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- 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: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31317 Palmer Dabbelt changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |palmer at gcc dot gnu.org --- Comment #1 from Palmer Dabbelt --- IIUC this is an ABI grey area. I guess we could write down this as a requirement and then call it a mold bug, but it seems better to just stop taking advantage of the behavior if we can. I guess something like diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h index 0cbb476c05..a540760f6f 100644 --- a/sysdeps/riscv/dl-machine.h +++ b/sysdeps/riscv/dl-machine.h @@ -348,7 +348,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], gotplt[1] =3D (ElfW(Addr)) l; } - if (l->l_type =3D=3D lt_executable && l->l_scope !=3D NULL) + if (l->l_type =3D=3D lt_executable && l->l_relocated && l->l_scope !=3D = NULL) { /* The __global_pointer$ may not be defined by the linker if the $gp register does not be used to access the global variable would squash the crash. Maybe that's good enough for static-PIE? We also = load up GP in _start, and it's not like MIPS where we have per-object GP values = so I think we should be safe? --=20 You are receiving this mail because: You are on the CC list for the bug.=