[PATCH] Reload undefined atoms to use possibly new undefines.

Rui Ueyama ruiu at google.com
Thu Nov 14 16:35:32 PST 2013


PIng.


On Tue, Nov 12, 2013 at 10:22 PM, Rui Ueyama <ruiu at google.com> wrote:

> As Resolver tries to resolve all undefined atoms, it loads new files. The
> new
> files can contain any kind of atoms, namely, defined, undefined and
> shared. It's
> possible that there's a file that contains the same undefined atom that's
> being
> resolved now in the Resolver's for-loop.
>
> A new undefined atom may have different fallback atom from the previous
> one.
> Currently, such new fallback atom definitions are ignored because although
> the new atom is stored to the symbol table, it's not used by Resolver. This
> patch fixes that issue by reloading undefined atoms, so that Resolver will
> always do based on the most recent state of the symbol table.
>
> There's no performance penalty introduced by this patch -- just in case if
> you
> are wondering. isDefined() uses findByName internally, so the cost is the
> same.
>
> http://llvm-reviews.chandlerc.com/D2162
>
> Files:
>   lib/Core/Resolver.cpp
>
> Index: lib/Core/Resolver.cpp
> ===================================================================
> --- lib/Core/Resolver.cpp
> +++ lib/Core/Resolver.cpp
> @@ -166,7 +166,10 @@
>        // If the undefined symbol has an alternative name, try to resolve
> the
>        // symbol with the name to give it a second chance. This feature is
> used
>        // for COFF "weak external" symbol.
> -      if (!_symbolTable.isDefined(undefName)) {
> +      const Atom *maybeUndefAtom = _symbolTable.findByName(undefName);
> +      assert(maybeUndefAtom);
> +      if (const UndefinedAtom *undefAtom = dyn_cast<const UndefinedAtom>(
> +              maybeUndefAtom)) {
>          if (const UndefinedAtom *fallbackUndefAtom =
> undefAtom->fallback()) {
>            _symbolTable.addReplacement(undefAtom, fallbackUndefAtom);
>            _symbolTable.add(*fallbackUndefAtom);
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131114/51f77b7f/attachment.html>


More information about the llvm-commits mailing list