From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id E087B3857C43; Mon, 4 Apr 2022 13:00:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E087B3857C43 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: 6e80962c46568bb544b21285ddf2aa760e776c35 X-Git-Newrev: 6cf5a5d458c11b838bfbcaa6c6a5cf6c45bc3047 Message-Id: <20220404130058.E087B3857C43@sourceware.org> Date: Mon, 4 Apr 2022 13:00:58 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2022 13:00:59 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6cf5a5d458c11b838bfbcaa6c6a5cf6c45bc3047 commit 6cf5a5d458c11b838bfbcaa6c6a5cf6c45bc3047 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 1294c91816..f30e1399f3 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -109,7 +109,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); } @@ -119,7 +119,7 @@ __tls_init_tp (void) all targets support __thread_pointer, so set __rseq_offset only if thre 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 }