[PECOFF] Fix a bug in /export option handler.
authorRui Ueyama <ruiu@google.com>
Wed, 3 Dec 2014 04:34:20 +0000 (04:34 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 3 Dec 2014 04:34:20 +0000 (04:34 +0000)
commitd31cf6065f4c096cf703ea32f84fa843b44a978b
tree73b54e4f330983ad76e87fcb5fd050d3e6fe034c
parent1f0dded057a77250c7122d89c29275c1c599127e
[PECOFF] Fix a bug in /export option handler.

/export option can be given multiple times to specify multiple
symbols to be exported. /export accepts both decorated and
undecorated name.

If you give both undecorated and decorated name of the same symbol
to /export, they are resolved to the same symbol. In this case,
we need to de-duplicate the exported names, so that we don't have
duplicated items in the export symbol table in a DLL.

We remove duplicate items from a vector. The bug was there.
Because we had pointers pointing to elements of the vector,
after an item is removed, they would point wrong elements.

This patch is to remove these pointers. Added a test for that case.

llvm-svn: 223200
lld/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
lld/test/pecoff/export.test