From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C459D3858C52; Mon, 22 Jul 2024 17:28:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C459D3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1721669280; bh=7nvsSTz5xtYJHhbBbCAs2FXHRQgQPTYEikPy77hKBB0=; h=From:To:Subject:Date:From; b=JhymMWUyQcJwPTRPh/LMwsdHBlkVXTOdxLcaOtt14JATsXC82t55ttbFMGPsiuEtB A+s0yp6QRWVLxwD5M8T7AwFAmihKdH0sZdlnFQyGfGx6jV5GLvLvk05IjYE23SMUjh 47Wk2Z/b00+fZYR3+AQQFk6ClczCEFxMKD2AWozA= From: "nsz at gcc dot gnu.org" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/32008] New: aarch64: tlsdesc can be optimized by custom tlsdesc calls for common cases Date: Mon, 22 Jul 2024 17:28:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nsz 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D32008 Bug ID: 32008 Summary: aarch64: tlsdesc can be optimized by custom tlsdesc calls for common cases Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: nsz at gcc dot gnu.org Target Milestone: --- the static tls case is essentially: size_t _dl_tlsdesc_return(size_t *got) { return got[1]; // offset } the dynamic tls fast path is size_t _dl_tlsdesc_dynamic(size_t *got) { void *tp =3D gettp(); void **dtv =3D *(void ***)tp; size_t *data =3D (size_t *)got[1]; size_t modid =3D data[0]; size_t offset =3D data[1]; size_t gencount =3D data[2]; if (gencount < (size_t)dtv[0] && dtv[modid] !=3D UNALLOCATED) return dtv[modid] + offset - tp; //... } can be optimized under the assumption that certain modid or offset values are common (e.g. modid < 8 or offset =3D=3D 0): for such cases use a custom _dl_tlsdesc_* when the tlsdesc relocation is processed. e.g. size_t _dl_tlsdesc_return42(size_t *got) { return 42; } can be used for a tlsdesc reloc if the module uses static tls and the tp offset to the variable ends up 42. this of course does not save much and rarely useful, but for the dynamic case it may be possible to save many instructions if some common modid/offset/gen cases have separate asm entry points: even if bug 31995 is not fixed similar optimization to the proposed fix for bug 27404 can be implemented. --=20 You are receiving this mail because: You are on the CC list for the bug.=