[lld] r314095 - Do not sort CU vectors.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 11 18:11:56 PDT 2017
Rui Ueyama via llvm-commits <llvm-commits at lists.llvm.org> writes:
> Author: ruiu
> Date: Sun Sep 24 22:30:39 2017
> New Revision: 314095
>
> URL: http://llvm.org/viewvc/llvm-project?rev=314095&view=rev
> Log:
> Do not sort CU vectors.
>
> We used to sort and uniquify CU vectors, but looks like CU vectors in
> .gdb_index sections created by gold are not guaranteed to be sorted.
>
> Modified:
> lld/trunk/ELF/SyntheticSections.cpp
>
> Modified: lld/trunk/ELF/SyntheticSections.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=314095&r1=314094&r2=314095&view=diff
> ==============================================================================
> --- lld/trunk/ELF/SyntheticSections.cpp (original)
> +++ lld/trunk/ELF/SyntheticSections.cpp Sun Sep 24 22:30:39 2017
> @@ -1797,16 +1797,17 @@ std::vector<std::vector<uint32_t>> GdbIn
> Off += Ent.Name.size() + 1;
> Ret.push_back({});
> }
> - Ret[Sym->CuVectorIndex].push_back((Ent.Type << 24) | Idx);
> +
> + // gcc 5.4.1 produces a buggy .debug_gnu_pubnames that contains
> + // duplicate entries, so we want to dedup them.
> + std::vector<uint32_t> &Vec = Ret[Sym->CuVectorIndex];
> + uint32_t Val = (Ent.Type << 24) | Idx;
> + if (Vec.empty() || Vec.back() != Val)
> + Vec.push_back(Val);
Are the duplicates always (or at lest frequently) adjacent?
Cheers,
Rafael
More information about the llvm-commits
mailing list