[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/j
From: |
i at maskray dot me |
Subject: |
[Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo` |
Date: |
Sun, 10 Jan 2021 21:43:22 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27169
--- Comment #4 from Fangrui Song <i at maskray dot me> ---
(In reply to H.J. Lu from comment #3)
> (In reply to Fangrui Song from comment #2)
> > (In reply to H.J. Lu from comment #1)
> > > Since i386 doesn't have IP-relative addressing, non-PIC PLT is different
> > > from PIC PLT. Using R_386_PLT32 for "call/jmp foo" isn't appreciate.
> >
> > I know that this is a convention using R_386_PC32 for non-PIC PLT and
> > R_386_PLT32. It is artificial and assembler/linker/ld.so do not need this
> > convention for interop.
>
> R_386_PLT32 should be used with the EBX based PLT and "call foo" doesn't
> require setting up EBX for PLT.
>
> > On most other architectures branch relocation types are distinguishable from
> > address taken relocation types (direct access).
>
> This can't be fixed with R_386_PLT32.
Does GNU ld use R_386_PC32/R_386_PLT32 to decide whether a non-PIC PLT or a PIC
PLT should be used? It can use a non-PIC PLT in -no-pie mode and a PIC PLT in
-pie/-shared mode. Then branch R_386_PC32 can be freely converted to PLT32.
# a.s
call foo
# b.s
call foo@plt
gcc -fno-pic a.s -shared -o a.so -fuse-ld=bfd
gcc -fno-pic b.s -shared -o b.so -fuse-ld=bfd
do not have instruction difference.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gas/27169] New: i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, i at maskray dot me, 2021/01/09
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, i at maskray dot me, 2021/01/09
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, hjl.tools at gmail dot com, 2021/01/10
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, i at maskray dot me, 2021/01/10
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, hjl.tools at gmail dot com, 2021/01/10
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`,
i at maskray dot me <=
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, i at maskray dot me, 2021/01/10
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, hjl.tools at gmail dot com, 2021/01/10
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, i at maskray dot me, 2021/01/10
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, hjl.tools at gmail dot com, 2021/01/10
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, hjl.tools at gmail dot com, 2021/01/12
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, i at maskray dot me, 2021/01/12
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, i at maskray dot me, 2021/01/12
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, hjl.tools at gmail dot com, 2021/01/13
- [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`, hjl.tools at gmail dot com, 2021/01/13