R_X86_64_COPY relocation implemented.
It fixes (at least I checked the mandelbrot set case):
https://llvm.org/bugs/show_bug.cgi?id=25283
It also fixed:
https://llvm.org/bugs/show_bug.cgi?id=25175
Differential D14090
[ELF2] R_X86_64_COPY relocation implemented Authored by grimar on Oct 26 2015, 1:22 PM.
Details R_X86_64_COPY relocation implemented. It fixes (at least I checked the mandelbrot set case): It also fixed:
Diff Detail Event Timeline
Comment Actions Review comments addressed.
Comment Actions About https://llvm.org/bugs/show_bug.cgi?id=25175: I found that this patch fixes it for -O3/O2/O1, so both ld and lld produces R_X86_64_COPY _ZSt4cout and executable works fine. #include <iostream> ~/LLVM/build/bin/clang++ -fuse-ld=lld2 -o out -O0 main.c then out contains R_X86_64_64 _ZSt4cout, but out-ld still has R_X86_64_COPY _ZSt4cout. Is it clang issue of lld one ? Comment Actions
And I mean that out crashes but out-ld works.
Comment Actions Added R_X86_64_64 to X86_64TargetInfo::relocNeedsCopy.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
E->Sym.getType() is accessible from Body, so you can only pass Body to relocNeedsCopy. Then you can write.
if (Target->relocNeedsCopy(Type, Body)) { Type = Target->getCopyReloc(); } else if (Target->relocNeedsPlt(Type, Body)) { ...