From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 951143858438; Fri, 9 Feb 2024 17:37:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 951143858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707500264; bh=NaTIAdTCgm8z9/mvPYgenycN/B1blWXN5nJWzxV+yGQ=; h=From:To:Subject:Date:From; b=TiYzFGyPKwY0HUynlZ+LNoBtwB9JvrnbvBuFGGdld7eFD4R09V4RhzRlvMgYG6F4n YCzEZjspwlkk4AuDQ5Y3Fc6Det+9plhcbYQD5CkyfV9d17Zp4vcQhKLQpuccD88LG1 ZgBb9+EimjnkLakhDSHR4UhszF63fIoMVlgxxeQs= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] elf: Use volatile to set __rseq_size and __rseq_offset X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: d1b5fdd9292292444976d51a2014934021ed25b9 X-Git-Newrev: 7f804e3daf94594ede54a1b7648a3a07cd4a5425 Message-Id: <20240209173744.951143858438@sourceware.org> Date: Fri, 9 Feb 2024 17:37:44 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7f804e3daf94594ede54a1b7648a3a07cd4a5425 commit 7f804e3daf94594ede54a1b7648a3a07cd4a5425 Author: Adhemerval Zanella Date: Sun Apr 3 11:23:20 2022 -0300 elf: Use volatile to set __rseq_size and __rseq_offset To avoid compiler to optimize them away. Diff: --- sysdeps/nptl/dl-tls_init_tp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index 092c274f36..4510c32404 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -107,7 +107,7 @@ __tls_init_tp (void) { /* We need a writable view of the variables. They are in .data.relro and are not yet write-protected. */ - extern unsigned int size __asm__ ("__rseq_size"); + extern volatile unsigned int size __asm__ ("__rseq_size"); size = sizeof (pd->rseq_area); } @@ -117,7 +117,7 @@ __tls_init_tp (void) all targets support __thread_pointer, so set __rseq_offset only if the rseq registration may have happened because RSEQ_SIG is defined. */ - extern ptrdiff_t offset __asm__ ("__rseq_offset"); + extern volatile ptrdiff_t offset __asm__ ("__rseq_offset"); offset = (char *) &pd->rseq_area - (char *) __thread_pointer (); #endif }