Bug 251251 - --cref on ld.lld writes the cref table to stdout even with -Map=filename
Summary: --cref on ld.lld writes the cref table to stdout even with -Map=filename
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-19 09:36 UTC by janm
Modified: 2020-11-24 16:29 UTC (History)
1 user (show)

See Also:


Attachments
Patch to make --cref output go to the files specified for -Map=name (1.47 KB, patch)
2020-11-24 11:35 UTC, janm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description janm 2020-11-19 09:36:35 UTC
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.
Comment 1 Mark Johnston freebsd_committer 2020-11-23 16:00:10 UTC
If this is purely an lld bug, which it appears to be, the bug should be filed with the LLVM project instead.
Comment 2 janm 2020-11-24 11:35:44 UTC
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
Comment 3 janm 2020-11-24 11:36:42 UTC
(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.
Comment 4 janm 2020-11-24 16:29:13 UTC
Reported to the LLVM project as https://bugs.llvm.org/show_bug.cgi?id=48282