Fwd: [PATCH] Mark _PROCEDURE_LINKAGE_TABLE_ as code instead of data

Yu-Cheng Liang yclwlcy@gmail.com
Thu Mar 13 16:59:25 GMT 2025


Hi Alan,

I noticed that there is no disassembly issue in RISC-V ELF shared
objects because _PROCEDURE_LINKAGE_TABLE_ isn't placed in the .plt
section. However, in RISC-V ELF executables, _PROCEDURE_LINKAGE_TABLE_
is placed in the .plt section, which causes a disassembly issue. From
my understanding, _PROCEDURE_LINKAGE_TABLE_ should be treated as code
in RISC-V ELF, though I'm not sure if this applies to every target.

Thanks,
Yu-Cheng

On Tue, Feb 18, 2025 at 8:01 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Mon, Feb 17, 2025 at 03:11:36PM +0800, Yu-Cheng Liang wrote:
> > Because .plt won't be disassembled properly as follows if
> > _PROCEDURE_LINKAGE_TABLE_ is set to STT_OBJECT.
>
> It disassembles OK for riscv64 .so files.  So your claim isn't 100%
> true.  You might like to investigate why.  I think there is a much
> simpler fix for riscv than changing _PROCEDURE_LINKAGE_TABLE_ for
> every target.
>
> > Actual Result:
> > Disassembly of section .plt:
> >
> > 0000000000010630 <_PROCEDURE_LINKAGE_TABLE_>:
> >    10630:       97 23 00 00 33 03 c3 41 03 be 03 9d 13 03 43 fd
> > .#..3..A......C.
> >    10640:       93 82 03 9d 13 53 13 00 83 b2 82 00 67 00 0e 00
> > .....S......g...
> >
> > -------------------------------------------------------------------------------------
> > Expected Result:
> > Disassembly of section .plt:
> >
> > 0000000000010630 <_PROCEDURE_LINKAGE_TABLE_>:
> >    10630:   00002397                auipc   t2,0x2
> >    10634:   41c30333                sub     t1,t1,t3
> >    10638:   9d03be03                ld      t3,-1584(t2) # 0x19d0 <.text+0x19d0>
> >    1063c:   fd430313                addi    t1,t1,-44
> >    10640:   9d038293                addi    t0,t2,-1584
> >    10644:   00135313                srli    t1,t1,0x1
> >    10648:   0082b283                ld      t0,8(t0)
> >    1064c:   000e0067                jr      t3
> >
> > Yu-Cheng
> >
> > On Mon, Feb 10, 2025 at 6:14 PM Alan Modra <amodra@gmail.com> wrote:
> > >
> > > On Mon, Feb 10, 2025 at 04:17:45PM +0800, Yu-Cheng Liang wrote:
> > > > The .plt section should be treated as code instead of data.
> > >
> > > Why do you think _PROCEDURE_LINKAGE_TABLE_ should be STT_FUNC?
> > >
> > > --
> > > Alan Modra
>
> --
> Alan Modra


More information about the Binutils mailing list