COFF: Make link order compatible with MSVC link.exe.
authorRui Ueyama <ruiu@google.com>
Tue, 23 Jun 2015 23:56:39 +0000 (23:56 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 23 Jun 2015 23:56:39 +0000 (23:56 +0000)
commit0d2e99905086f3ec418dc26f8930e535e7d1837c
tree8b73e70a84c12311863ff31f3c4ec4437cb3d8a0
parent240fc1e0aab8558ed9fa5da1ee74530a9262e7d5
COFF: Make link order compatible with MSVC link.exe.

Previously, we added files in directive sections to the symbol
table as we read the sections, so the link order was depth-first.
That's not compatible with MSVC link.exe nor the old LLD.

This patch is to queue files so that new files are added to the
end of the queue and processed last. Now addFile() doesn't parse
files nor resolve symbols. You need to call run() to process
queued files.

llvm-svn: 240483
lld/COFF/Driver.cpp
lld/COFF/Driver.h
lld/COFF/SymbolTable.cpp
lld/COFF/SymbolTable.h
lld/COFF/Writer.cpp
lld/test/COFF/order.test [new file with mode: 0644]