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 func@plt"); > > 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 func@plt") to asm("a: .long func@plt - > .") > the generated code is very weird and is off by 4: @PLT is PC relative. Why do you want to use "func@plt - ."? -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils