public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: mengqinggang <mengqinggang@loongson.cn>, libc-alpha@sourceware.org
Cc: adhemerval.zanella@linaro.org, xuchenghua@loongson.cn,
	caiyinyu@loongson.cn,  chenglulu@loongson.cn,
	cailulu@loongson.cn, i.swmail@xen0n.name,  maskray@google.com,
	luweining@loongson.cn, wanglei@loongson.cn,
	 hejinyang@loongson.cn
Subject: Re: [PATCH v5] LoongArch: Add support for TLS Descriptors
Date: Tue, 14 May 2024 13:25:08 +0800	[thread overview]
Message-ID: <8b653b61e8977209ea2921d63ba7993ad3e3123f.camel@xry111.site> (raw)
In-Reply-To: <be90dce8-eaef-77f1-623e-aaa7c3c72a11@loongson.cn>

On Tue, 2024-05-14 at 09:43 +0800, mengqinggang wrote:
> 
> 在 2024/4/29 下午3:13, Xi Ruoyao 写道:
> > On Fri, 2024-04-26 at 15:01 +0800, mengqinggang wrote:
> > 
> > > +_dl_tlsdesc_dynamic:
> > > +	/* Save just enough registers to support fast path, if we fall
> > > +	   into slow path we will save additional registers.  */
> > > +	ADDI	sp, sp,-24
> > > +	REG_S	t0, sp, 0
> > > +	REG_S	t1, sp, 8
> > > +	REG_S	t2, sp, 16
> > So t3 is not saved in the fast path.  And then...
> > 
> > 
> > > +.Lslow:
> > > +	/* This is the slow path. We need to call __tls_get_addr() which
> > > +	   means we need to save and restore all the register that the
> > > +	   callee will trash.  */
> > > +
> > > +	/* Save the remaining registers that we must treat as caller save.  */
> > > +	ADDI	sp, sp, -FRAME_SIZE
> > > +	REG_S	ra, sp, 0 * SZREG
> > > +	REG_S	a1, sp, 1 * SZREG
> > > +	REG_S	a2, sp, 2 * SZREG
> > > +	REG_S	a3, sp, 3 * SZREG
> > > +	REG_S	a4, sp, 4 * SZREG
> > > +	REG_S	a5, sp, 5 * SZREG
> > > +	REG_S	a6, sp, 6 * SZREG
> > > +	REG_S	a7, sp, 7 * SZREG
> > Missing t3 here.  This causes tst-gnu2-tls2 segfault.
> 
> 
> By the way, how did you find this problem? Missing t3 not cause
> tst-gnu2-tls2 segfault on my environment.

Maybe just lucky...  The register allocation in GCC changes frequently
and perhaps I just happened to use a GCC snapshot which uses t3 for a
pointer.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

      reply	other threads:[~2024-05-14  5:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  7:01 mengqinggang
2024-04-29  5:51 ` Xi Ruoyao
2024-04-29  7:13 ` Xi Ruoyao
2024-05-14  1:43   ` mengqinggang
2024-05-14  5:25     ` Xi Ruoyao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b653b61e8977209ea2921d63ba7993ad3e3123f.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=adhemerval.zanella@linaro.org \
    --cc=cailulu@loongson.cn \
    --cc=caiyinyu@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=hejinyang@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=libc-alpha@sourceware.org \
    --cc=luweining@loongson.cn \
    --cc=maskray@google.com \
    --cc=mengqinggang@loongson.cn \
    --cc=wanglei@loongson.cn \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).