[PATCH] D16887: Avoid code duplication when creating dynamic relocations

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 13:33:13 PST 2016


> Comment at: ELF/OutputSections.cpp:258
> @@ +257,3 @@
> +    P->r_offset = getOffset(Rel);
> +    uint32_t SymIdx = (!Rel.UseSymVA && Sym) ? Sym->DynsymIndex : 0;
> +    P->setSymbolAndType(SymIdx, Rel.Type, Config->Mips64EL);
> ----------------
> Is this equivalent to
>
>   uint32_t SymIdx = Rel.UseSymVA ? 0 : Sym->DynsymIndex;
>
> ? (You seem to assume that if UseSymVA is true, Rel.Sym is not false in a few lines above this one.)

It is not. When UseSymVA is false Sym can be null.

Cheers,
Rafael


More information about the llvm-commits mailing list