Thank you for your guidance. Your comments were very helpful. In version v3, I will use other methods for instruction deletion, do not use delete relocation delete instructions, and modify and check the code format. 发件人:Xi Ruoyao 发送日期:2023-12-02 15:20:46 收件人:changjiachen ,binutils@sourceware.org 抄送人: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 主题:Re: [PATCH v2 1/5] LoongArch: bfd: Add support for tls le relax.>On Sat, 2023-12-02 at 14:53 +0800, changjiachen wrote: >> + switch (ELFNN_R_TYPE (rel_hi->r_info)) >> + { >> + case R_LARCH_TLS_LE_HI20_R: >> + case R_LARCH_TLS_LE_ADD_R: > >Format issue: "case" should be aligned with "{". > >> + /* delete insn. */ >> + rel_hi->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel_hi->r_info), >> + R_LARCH_DELETE); > >IIRC R_LARCH_DELETE has caused some issues before, so Qinggang has >removed the uses of it. Are you sure using it is OK here or should we >just avoid it as well? > >> + break; >> + case R_LARCH_TLS_LE_LO12_R: >> + /* Change rj to $tp. */ >> + insn_rj = 0x2 << 5; >> + /* Get rd register. */ >> + insn_rd = insn & 0x1f; >> + /* Write symbol offset. */ >> + symval <<= 10; >> + /* Writes the modified instruction. */ >> + insn = insn & 0xffc00000; >> + insn = insn | symval | insn_rj | insn_rd; >> + bfd_put (32, abfd, insn, contents + rel_hi->r_offset); >> + break; >> + default: >> + break; >> + } > >-- >Xi Ruoyao >School of Aerospace Science and Technology, Xidian University