[PATCH] D29391: [ELF] - Postpone the evaluation of DefinedSynthetic value

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 11:05:50 PST 2017


> Index: ELF/Symbols.h
> ===================================================================
> --- ELF/Symbols.h
> +++ ELF/Symbols.h
> @@ -232,13 +232,13 @@
>                     const OutputSectionBase *Section)
>        : Defined(SymbolBody::DefinedSyntheticKind, Name, /*IsLocal=*/false,
>                  llvm::ELF::STV_HIDDEN, 0 /* Type */),
> -        Value(Value), Section(Section) {}
> +        GetValue([=] { return Value; }), Section(Section) {}
>  
>    static bool classof(const SymbolBody *S) {
>      return S->kind() == SymbolBody::DefinedSyntheticKind;
>    }
>  
> -  uint64_t Value;
> +  std::function<uint64_t()> GetValue;


We should *NOT* do this. If the symbol is created too early we should
delay the symbol creation, not turn Value into a callback.

Please include a new minimal testcase of what is being fixed in the
patch.

Cheers,
Rafael


More information about the llvm-commits mailing list