[PATCH] D43351: Relax relocation type checking in a non-ALLOC section.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 15 16:24:58 PST 2018
Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:
> Index: lld/ELF/InputSection.cpp
> ===================================================================
> --- lld/ELF/InputSection.cpp
> +++ lld/ELF/InputSection.cpp
> @@ -641,6 +641,14 @@
>
> for (const RelTy &Rel : Rels) {
> RelType Type = Rel.getType(Config->IsMips64EL);
> +
> + // 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.
> + if (Config->EMachine == EM_386 && Type == R_386_GOTPC)
> + continue;
> +
> uint64_t Offset = getOffset(Rel.r_offset);
> uint8_t *BufLoc = Buf + Offset;
> int64_t Addend = getAddend<ELFT>(Rel);
> @@ -651,17 +659,20 @@
> RelExpr Expr = Target->getRelExpr(Type, Sym, BufLoc);
> if (Expr == R_NONE)
> continue;
> - if (Expr != R_ABS) {
> - // 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.
> - if (Config->EMachine == EM_386 && Type == R_386_GOTPC)
> - continue;
>
> - error(getLocation<ELFT>(Offset) + ": has non-ABS relocation " +
> - toString(Type) + " against symbol '" + toString(Sym) + "'");
> - return;
> + if (Expr != R_ABS) {
This if can now be
if (Expr == R_PC)
no?
LGTM with that.
Cheers,
Rafael
More information about the llvm-commits
mailing list