File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1800,13 +1800,15 @@ void GnuHashTableSection::addSymbols(std::vector<SymbolTableEntry> &V) {
1800
1800
return !S.Sym ->isDefined ();
1801
1801
});
1802
1802
1803
- // Even if the hash table does not contain symbols, we still want to keep the
1804
- // section to indicate to a loader that the file exports no symbols. We can't
1805
- // have zero buckets because the android loader doesn't support that. We chose
1806
- // load factor 4 for the on-disk hash table. For each hash collision, the
1807
- // dynamic linker will compare a uint32_t hash value. Since the integer
1808
- // comparison is quite fast, we believe we can make the load factor even
1809
- // larger. 4 is just a conservative choice.
1803
+ // We chose load factor 4 for the on-disk hash table. For each hash
1804
+ // collision, the dynamic linker will compare a uint32_t hash value.
1805
+ // Since the integer comparison is quite fast, we believe we can
1806
+ // make the load factor even larger. 4 is just a conservative choice.
1807
+ //
1808
+ // Note that we don't want to create a zero-sized hash table because
1809
+ // Android loader as of 2018 doesn't like a .gnu.hash containing such
1810
+ // table. If that's the case, we create a hash table with one unused
1811
+ // dummy slot.
1810
1812
NBuckets = std::max<size_t >((V.end () - Mid) / 4 , 1 );
1811
1813
1812
1814
if (Mid == V.end ())
You can’t perform that action at this time.
0 commit comments