From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 16269385DC02; Thu, 21 Dec 2023 18:59:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16269385DC02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703185181; bh=hCDofXnn2/aSio7faZBdgCIYrCeJZg8DWt6j/COkZiw=; h=From:To:Subject:Date:From; b=YqSxuxbbg/21SKe7oKNBXl0mwKveq0RkPe810hju8aLngyJ9HNSG69HxebTXPtekh gp313OPMo1nIFnf1o6eNLFgqHHIY49oCfrYUox0DXgagdsj3XY5KEkRTuoXvJ1lTp1 XWtT6aTIEjp2thf7+qKJIDD/z8823aDFhRjMNQfk= 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: 919d1a1fc722b36c490009306d4a410365a24c2a X-Git-Newrev: d53ca41b98e2aad774f0393ebc439b553425d5da Message-Id: <20231221185941.16269385DC02@sourceware.org> Date: Thu, 21 Dec 2023 18:59:41 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d53ca41b98e2aad774f0393ebc439b553425d5da commit d53ca41b98e2aad774f0393ebc439b553425d5da 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 2ed98c5a31..dfd8591575 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 }