public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: 常佳琛 <changjiachen@stu.xupt.edu.cn>
To: Xi Ruoyao <xry111@xry111.site>, binutils@sourceware.org
Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn,
	liuzhensong@loongson.cn,  i.swmail@xen0n.name,
	maskray@google.com, cailulu@loongson.cn,  luweining@loongson.cn,
	wanglei@loongson.cn, hejinyang@loongson.cn,  Lazy_Linux@126.com,
	mengqinggang@loongson.cn
Subject: Re:Re: [PATCH v3 0/5] LoongArch tls le model linker relaxation support.
Date: Tue, 19 Dec 2023 13:33:36 +0800 (GMT+08:00)	[thread overview]
Message-ID: <AGsAUwD-GFDToazfBnnO7qpf.3.1702964016138.Hmail.changjiachen@stu.xupt.edu.cn> (raw)
In-Reply-To: <89b2e2062115e127965a4bd6b64e9181d397b7bf.camel@xry111.site>

[-- Attachment #1: Type: text/plain, Size: 3012 bytes --]









From: Xi Ruoyao <xry111@xry111.site>
Date: 2023-12-15 20:34:50
To:  changjiachen <changjiachen@stu.xupt.edu.cn>,binutils@sourceware.org
Cc:  xuchenghua@loongson.cn,chenglulu@loongson.cn,liuzhensong@loongson.cn,i.swmail@xen0n.name,maskray@google.com,cailulu@loongson.cn,luweining@loongson.cn,wanglei@loongson.cn,hejinyang@loongson.cn,Lazy_Linux@126.com,mengqinggang@loongson.cn
Subject: Re: [PATCH v3 0/5] LoongArch tls le model linker relaxation support.>On Fri, 2023-12-15 at 18:06 +0800, changjiachen wrote:
>> First, after a test, the R_LARCH_TLS_LE_ADD_R can be generated using ".reloc.,R_LARCH_TLS_LE_ADD_R,sym", 
>> or "%le_add_r(sym)". However,".reloc" generates R_LARCH_TLS_LE_ADD_R relocation directly, and it is not 
>> easy to add "R_LARCH_RELAX" relocation. "%le_add_r(sym)" Adds the R_LARCH_TLS_LE_ADD_R and R_LARCH_RELAX 
>> relocation commands, which is easier to implement.
>>
>> Of course, there is another way to generate ".reloc.,R_LARCH_TLS_LE_ADD_R,sym" and 
>> ".reloc.,R_LARCH_RELAX,sym" directly in gcc. However, this implementation causes the 
>> -mrelax/-mno-relax option to be set in both gcc and gas, which can be confusing.
>
>GCC 14 already have -mrelax/-mno-relax options.  This is not confusing
>at all.
>
>> One problem with this is that add.d $r12,$r12,$r2 and add.d $r12,$r12,$r2, 
>> %le_add_r(sym) are too similar, so I have to add comments in loongarch_fix_opcodes[]. 
>> The goal is to make it as clear as possible to developers.
>
>No, normal developers (not Binutils developers) should not be mandated
>to read Binutils code to understand something.  OTOH they should read
>the documentation of GAS.  So make it clear somewhere in the doc.
>
>And I've told you if you must go with an additional operand in add.d,
>you should reject things like:
>
>add.d $a0,$a0,$a0,8
>
>but now:
>
>$ cat t.s
>add.d $a0,$a0,$a0,8
>$ gas/as-new t.s
>$ binutils/objdump -d a.out
>
>a.out:     file format elf64-loongarch
>
>
>Disassembly of section .text:
>
>0000000000000000 <.text>:
>   0:	0010b084 	add.d       	$a0, $a0, $t0
>
>Now is it clear that this behavior is unacceptable?
>
>Is it too difficult or unreasonable to make it an error with message
>"the fourth operand of the add.d instruction must be %le_add_r"?!  Or
>didn't I make it clear?
Hello, I understand what you mean. For the fourth operand of tls add.d instruction, 
I have made the following modifications.


For the case of "add.d $a0,$a0,$a0,8", that is, when the fourth operand of the tls add.d 
instruction is not %le_add_r(sym), the modified assembler throws a "no match insn add.d $a0,$a0,$a0,8".


example:
a.s
add.d $a0,$a0,$a0,8
$ gas/as-new a.s
a.s: Assembler messages:
a.s:1: error:no match insn: add.d	$a0,$a0,$a0,8



Can such modification solve the problem you raised? 
I will add this change to v4 patch if possible.
I am very much looking forward to your suggestions again.








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





  reply	other threads:[~2023-12-19  5:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 10:06 changjiachen
2023-12-15 10:06 ` [PATCH v3 1/5] LoongArch: bfd: Add support for tls le relax changjiachen
2023-12-15 10:06 ` [PATCH v3 2/5] LoongArch: include: " changjiachen
2023-12-15 10:06 ` [PATCH v3 3/5] LoongArch: opcodes: " changjiachen
2023-12-15 10:06 ` [PATCH v3 4/5] LoongArch: gas: " changjiachen
2023-12-15 10:06 ` [PATCH v3 5/5] LoongArch: ld: " changjiachen
2023-12-15 12:34 ` [PATCH v3 0/5] LoongArch tls le model linker relaxation support Xi Ruoyao
2023-12-19  5:33   ` 常佳琛 [this message]
2023-12-19 10:21     ` Xi Ruoyao

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=AGsAUwD-GFDToazfBnnO7qpf.3.1702964016138.Hmail.changjiachen@stu.xupt.edu.cn \
    --to=changjiachen@stu.xupt.edu.cn \
    --cc=Lazy_Linux@126.com \
    --cc=binutils@sourceware.org \
    --cc=cailulu@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=hejinyang@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=liuzhensong@loongson.cn \
    --cc=luweining@loongson.cn \
    --cc=maskray@google.com \
    --cc=mengqinggang@loongson.cn \
    --cc=wanglei@loongson.cn \
    --cc=xry111@xry111.site \
    --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).