[PATCH] D28714: Directly write to a -Map file.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 14 06:04:55 PST 2017


Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu created this revision.
> ruiu added a reviewer: rafael.
> ruiu added a subscriber: llvm-commits.
>
> Previous code had a bug that if the program exits with an assert()
> or fail() before the control reaches end of writeMapFile(), it left
> a temporary file, because FileRemover's dtor didn't run.
>
> I could fix that by removeFileOnSignal() and other functions, but
> I think we can simply write to the result file directly. I think
> that is straightforward and easy to understand.
>
> Additionally, that allows something like `-Map /dev/null` or a bash
> hack such as `-Map >(grep -U symbol-im-looking-for)`. Previously,
> that kind of things didn't work.

The flip side is that we would leave a partial output file. That is a
big problem if -Map's output is used in a build system. That doesn't
seems to be the case, so LGTM.

I will try to find time to fix our temporary file handling once the
freebsd ports is done. We can then reevaluate this.

Cheers,
Rafael


More information about the llvm-commits mailing list