[ELF] -Map --why-extract=: print despite errors
authorFangrui Song <i@maskray.me>
Wed, 12 Jan 2022 18:40:33 +0000 (10:40 -0800)
committerFangrui Song <i@maskray.me>
Wed, 12 Jan 2022 18:40:33 +0000 (10:40 -0800)
commit5014d6fc53d8208cf5940fb1ccab62e78ee2f146
treead72f63eba18d9dc830190d35f8a57ffb9a6de64
parentdb08df0570b6dfaf00d7b1b8555c1d2d4effb224
[ELF] -Map --why-extract=: print despite errors

Fix https://github.com/llvm/llvm-project/issues/53073

In case of a relocation error, GNU ld's link map includes
the archive member extraction information but not output sections.

Our -Map and --why-extract= are currently no-op in case of an error.
This change makes the two options work.

Reviewed By: ikudrin, peter.smith

Differential Revision: https://reviews.llvm.org/D116838
lld/ELF/Writer.cpp
lld/test/ELF/map-file.s
lld/test/ELF/why-extract.s