https://sourceware.org/bugzilla/show_bug.cgi?id=22844
Bug ID: 22844 Summary: Handling of R_X86_64_PC32 in a PIE against a function in a shared library could be better Product: binutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: gold Assignee: ccoutant at gmail dot com Reporter: rafael.espindola at gmail dot com CC: ian at airs dot com Target Milestone: --- Created attachment 10817 --> https://sourceware.org/bugzilla/attachment.cgi?id=10817&action=edit testcase The attached testcase has a shared library that defines a function foo with default visibility. The function just prints its own address and argument: void foo(void *bar) { printf("%p %p\n", bar, foo); } There is also a position independent executable that uses a R_X86_64_PC32 to find the address of foo and call it with that value. The expected result is to see the same value printed twice. If we try to use gold it errors out when linking the executable: error: test.o: requires dynamic R_X86_64_PC32 reloc against 'foo' which may overflow at runtime; recompile with -fPIC With ld.bfd after 1031c264fd23641111df1e12a35d0a8f7e82fb80 or ld.lld it works since a canonical plt entry for foo is created in the main executable: 6: 00000000000011f0 0 FUNC GLOBAL DEFAULT UND foo -- 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