Call File::beforeLink hook even if the file is in an archive.
authorRui Ueyama <ruiu@google.com>
Fri, 27 Feb 2015 23:15:11 +0000 (23:15 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 27 Feb 2015 23:15:11 +0000 (23:15 +0000)
commitc817fd22735b1b7b84855dd3fc462b26aca1747e
tree67a8ce1ae1f2f394a1de7a784cc0529831456388
parentf8bf9ddde4e8da2ff46b94ce8d6c785a2c2bddd3
Call File::beforeLink hook even if the file is in an archive.

Previously we didn't call the hook on a file in an archive, which
let the PE/COFF port fail to link files in archives. It was a
simple mistake. Added a call to the hook and also added a test to
catch that error.

const_cast is an unfortunate hack. Files in the resolver are usually
const, but they are not actually const objects, since they are
mutated if either a file is taken from an archive (an archive file
does never return the same file twice) or the beforeLink hook is
called. Maybe we should just remove const from there -- because they
are not const.

llvm-svn: 230808
lld/lib/Core/Resolver.cpp
lld/test/pecoff/Inputs/drectve3.lib [new file with mode: 0644]
lld/test/pecoff/drectve.test