The --cref option on ld.lld only seems to write to stdout, ignoring the -Map=filename option. This is a change from GNU ld. To reproduce, compile and link any code with --cref, for example: echo 'int main() { return 0; }' > test.c cc -Wl,-Map=test.map -Wl,--cref test.c The cross reference table is emitted on stdout instead of being written to test.map.
If this is purely an lld bug, which it appears to be, the bug should be filed with the LLVM project instead.
Created attachment 219921 [details] Patch to make --cref output go to the files specified for -Map=name Patch to make --cref output go to the file specified for -Map=name
(In reply to Mark Johnston from comment #1) Makes sense, I'll report upstream. In the meantime, a patch that resolves the issue for me is attached in case someone else comes looking for the same problem.
Reported to the LLVM project as https://bugs.llvm.org/show_bug.cgi?id=48282
https://reviews.llvm.org/D114663 will implement the GNU ld/gold behavior. bugs.llvm.org is in read-only mode as the issue tracker is being migrated to GitHub.