[PATCH v1] LoongArch: Fix relaxation alignment with ld -r (PR 33236)

Xi Ruoyao xry111@xry111.site
Sun Jun 7 09:00:44 GMT 2026


On Fri, 2026-06-05 at 17:56 +0800, Xi Ruoyao via Binutils wrote:
> On Fri, 2026-05-29 at 15:43 +0800, mengqinggang wrote:
> > +      /* Match if (r_symndx < symtab_hdr->sh_info) branch in
> > +	 loongarch_elf_relocate_section to avoid find link failed. 
> > */
> > +      symtab_hdr->sh_info = 1;
> > +//      symtab_hdr->sh_size = sizeof (Elf_Internal_Sym);
> > +//      symtab_hdr->sh_entsize = sizeof (Elf_Internal_Sym);
> > +//      symtab_hdr->sh_type = SHT_SYMTAB;
> > +//      symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s-
> > >log_file_align;
> 
> Hmm, just remove them?
> 
> > +      symtab_hdr->contents = (unsigned char *) sym;
> 
> I'll test if the change will break Linux kernel module this weekend.

It does not insert the nops when no inputs have R_LARCH_ALIGN, so kernel
module should be ok.

I've not seriously reviewed all the code change though (well I don't
think I'm really capable to do :).

-- 
Xi Ruoyao <xry111@xry111.site>


More information about the Binutils mailing list