[PATCH] D44422: [ELF] - Never create .gnu_hash with NBuckets == 0.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 13 11:19:29 PDT 2018


George Rimar via Phabricator via llvm-commits
<llvm-commits at lists.llvm.org> writes:

> Index: ELF/SyntheticSections.cpp
> ===================================================================
> --- ELF/SyntheticSections.cpp
> +++ ELF/SyntheticSections.cpp
> @@ -1799,15 +1799,16 @@
>            return SS->CopyRelSec == nullptr && !SS->NeedsPltAddr;
>          return !S.Sym->isDefined();
>        });
> -  if (Mid == V.end())
> -    return;
>  
>    // We chose load factor 4 for the on-disk hash table. For each hash
>    // collision, the dynamic linker will compare a uint32_t hash value.
>    // Since the integer comparison is quite fast, we believe we can make
>    // the load factor even larger. 4 is just a conservative choice.
>    NBuckets = std::max<size_t>((V.end() - Mid) / 4, 1);


Please update the comment to say:

* Why we want to keep this section: It indicates to a loader that the
  file exports no symbols.
* Why we can't use 0: The android loader doesn't support that.

With that, LGTM.

Thanks,
Rafael


More information about the llvm-commits mailing list