https://bugs.llvm.org/show_bug.cgi?id=34148
Bug ID: 34148
Summary: wrong code generated for extern_weak relocation with
-pic-level 2 -pic-is-pie -mpie-copy-relocations
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: richard-l...@metafoo.co.uk
CC: llvm-bugs@lists.llvm.org
Testcase:
extern "C" int printf(const char*, ...);
extern __attribute__((weak)) int n;
int main() { printf("%p\n", &n); }
Built with -pic-level 2 -pic-is-pie -mpie-copy-relocations, we generate this
bogus code:
leaq .L.str(%rip), %rdi
leaq n(%rip), %rsi
xorl %eax, %eax
callq printf@PLT
Note the %rip-relative lea for n: this is wrong, that relocation type cannot
represent the possibility that &n is 0, which happens when the symbol is not
defined.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs