ELF linker incompatibility
2020-12-19 17:00:00 Author: maskray.me(查看原文) 阅读量:211 收藏

Subtitle: Is LLD a drop-in replacement for GNU ld?

Piotr Kubaj said that this is a probably more of a marketing term than a technical term. It tries to lure existing users into thinking.

  1. The default image base for -no-pie is different. For example, on x86-64, GNU ld defaults to 0x400000 while LLD defaults to 0x200000.
  2. Different archive selection semantics. See http://lld.llvm.org/ELF/warn_backrefs.html for details.
  3. LLD defaults to -z relro by default. This is probably not a good default but it is difficult to change now. I have a comment https://bugs.llvm.org/show_bug.cgi?id=48549
  4. Different orphan section placement. GNU ld has very complex rules and certain section names have special semantics. LLD adopted some of its core ideas but made a lot of simplication:
  • output sections are given ranks
  • output sections are placed after symbol assignments

At some point we should document it. https://bugs.llvm.org/show_bug.cgi?id=42327 1. Text relocations. * In GNU ld, -z notext/-z text/unspecified are a tri-state. For -z notext/unspecified, the dynamic tags DT_TEXTREL and DF_TEXTREL are added on demand. If unspecified and GNU ld is configured with --enable-textrel-check=warning, a warning will be issued. * LLD has two states and add DT_TEXTREL and DF_TEXTREL if -z notext is specified.


文章来源: http://maskray.me/blog/2020-12-19-elf-linker-incompatibility
如有侵权请联系:admin#unsafe.sh