[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/23997] PLT32 relocation is off by 4
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug gas/23997] PLT32 relocation is off by 4 |
Date: |
Tue, 18 Dec 2018 02:17:44 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23997
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2018-12-18
CC| |hjl.tools at gmail dot com
Ever confirmed|0 |1
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Ruslan Nikolaev from comment #0)
> The bug was initially filed at
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88524 (see the discussion
> there) but turns out to be an assembler problem.
>
> Consider the following example for some -fpic -mcmodel=small compiled code.
> There is an external function func() for which we store a relative reference
> to the corresponding @plt stub in a 32-bit variable.
>
> The following seems to generate correct offsets (@plt is already relative, so
> we can probably specify it directly):
>
> void func(void);
>
> asm("a: .long address@hidden");
>
> extern int a;
>
> int geta()
> {
> return a;
> }
>
> gcc -Wall -O2 -c -fpic test.c
>
> yields
>
> RELOCATION RECORDS FOR [.text]:
> OFFSET TYPE VALUE
> 0000000000000000 R_X86_64_PLT32 func
> 0000000000000013 R_X86_64_REX_GOTPCRELX a-0x0000000000000004
>
> However, if we change asm("a: .long address@hidden") to asm("a: .long
> address@hidden -
> .")
> the generated code is very weird and is off by 4:
@PLT is PC relative. Why do you want to use "address@hidden - ."?
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gas/23997] New: PLT32 relocation is off by 4, nruslan_devel at yahoo dot com, 2018/12/16
- [Bug gas/23997] PLT32 relocation is off by 4, fweimer at redhat dot com, 2018/12/17
- [Bug gas/23997] PLT32 relocation is off by 4,
hjl.tools at gmail dot com <=
- [Bug gas/23997] PLT32 relocation is off by 4, nruslan_devel at yahoo dot com, 2018/12/18
- [Bug gas/23997] PLT32 relocation is off by 4, hjl.tools at gmail dot com, 2018/12/18
- [Bug gas/23997] PLT32 relocation is off by 4, nruslan_devel at yahoo dot com, 2018/12/18
- [Bug gas/23997] PLT32 relocation is off by 4, nruslan_devel at yahoo dot com, 2018/12/18
- [Bug gas/23997] PLT32 relocation is off by 4, nruslan_devel at yahoo dot com, 2018/12/19
- [Bug gas/23997] PLT32 relocation is off by 4, cvs-commit at gcc dot gnu.org, 2018/12/19
- [Bug gas/23997] PLT32 relocation is off by 4, hjl.tools at gmail dot com, 2018/12/19
- [Bug gas/23997] PLT32 relocation is off by 4, nruslan_devel at yahoo dot com, 2018/12/19
- [Bug gas/23997] PLT32 relocation is off by 4, hjl.tools at gmail dot com, 2018/12/19