[PATCH] D38625: [ELF] - Ignore non-absolute R_386_GOTPC relocation in debug sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 14:45:27 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/InputSection.cpp:669-673
+      // At the moment of 20 october 2017, gcc has a bug which creates
+      // R_386_GOTPC relocation against _GLOBAL_OFFSET_TABLE_ in .debug_info.
+      // We ignore such relocation. All gcc versions seem to be affected.
+      // TODO: remove this hack once issue is fixed and we stop supporting
+      //       gcc versions affected.
----------------
grimar wrote:
> ruiu wrote:
> > // GCC 8.0 or earlier have a bug that it emits R_386_GOTPC relocations against _GLOBAL_OFFSET_TABLE for .debug_info. The bug seems to have been fixed in 2017 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82630), but we need to keep this bug-compatible code for a while.
> > 
> > Also, you should be more explicit on what you are doing. Specifically, you should avoid calling getRelExpr.
> Maximal explicit way I think would be to check exact target specific relocation and a symbol name here.
> Do you prefer to check for R_386_GOTPC or both R_386_GOTPC and _GLOBAL_OFFSET_TABLE_ symbol name here ?
`Config->EMachine == EM_386 && Type == R_386_GOTPC` should suffice.


https://reviews.llvm.org/D38625





More information about the llvm-commits mailing list