[PATCH] D70398: [lld] Support copy relocations for TLS symbols

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 18:53:08 PST 2019


ruiu added a comment.

Copy relocation is a hack to allow non-PIC object files to be linked with DSOs. And it is a bit dangerous hack because people don't usually understand the exact semantics of the copy relocation and can make an ABI-breaking change without knowing it. I described the problem here: https://github.com/llvm/llvm-project/blob/master/lld/ELF/Relocations.cpp#L517-L558

Copy relocation also wastes a little bit of resource because for each copy relocation we'll have two copies of the same piece of data in memory.

Therefore, I believe that we should in general avoid copy relocations. So I'm inclined to just tell users what to do to avoid copy relocations rather than silently working around and hiding the issue. All users have to do is essentailly recompile object files with -fPIC, and that shouldn't be too hard.

What do you think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70398/new/

https://reviews.llvm.org/D70398





More information about the llvm-commits mailing list