[PATCH] D74510: [ELF] Fix a null pointer dereference when --emit-relocs and --strip-debug are used together

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 09:38:15 PST 2020


MaskRay added a comment.

In D74510#1874665 <https://reviews.llvm.org/D74510#1874665>, @nickdesaulniers wrote:

> > Regarding .gnu.linkonce*: I also want to delete them. I left a comment on https://sourceware.org/bugzilla/show_bug.cgi?id=20543 half a year ago.
>
> Removing support for .gnu.linkonce will break module loading in the Linux kernel.
>  See also: https://github.com/ClangBuiltLinux/linux/issues/432


What lld does is to simply discard `.gnu.linkonce.t.__x86.get_pc_thunk.bx` and `.gnu.linkonce.t.__i386.get_pc_thunk.bx` input sections from object files.
It never supports the semantics of `.gnu.linkonce`. Other `.gnu.linkonce.` prefixed section names (e.g. `.gnu.link_once.this_module`) are not recognized by lld.
So if something currently works, after removing the code below, it will continue working.

  // The linkonce feature is a sort of proto-comdat. Some glibc i386 object
  // files contain definitions of symbol "__x86.get_pc_thunk.bx" in linkonce
  // sections. Drop those sections to avoid duplicate symbol errors.
  // FIXME: This is glibc PR20543, we should remove this hack once that has been
  // fixed for a while.
  if (name == ".gnu.linkonce.t.__x86.get_pc_thunk.bx" ||
      name == ".gnu.linkonce.t.__i686.get_pc_thunk.bx")
    return &InputSection::discarded;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74510





More information about the llvm-commits mailing list