FreeBSD Bugzilla – Attachment 219921 Details for
Bug 251251
--cref on ld.lld writes the cref table to stdout even with -Map=filename
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to make --cref output go to the files specified for -Map=name
lld-cref.patch (text/plain), 1.47 KB, created by
Jan Martin Mikkelsen
on 2020-11-24 11:35:44 UTC
(
hide
)
Description:
Patch to make --cref output go to the files specified for -Map=name
Filename:
MIME Type:
Creator:
Jan Martin Mikkelsen
Created:
2020-11-24 11:35:44 UTC
Size:
1.47 KB
patch
obsolete
>--- src/contrib/llvm-project/lld/ELF/MapFile.cpp 2020-11-12 16:41:12.000000000 1100 >+++ src/contrib/llvm-project/lld/ELF/MapFile.cpp 2020-11-12 16:41:12.000000000 1100 >@@ -212,8 +212,8 @@ > } > } > >-static void print(StringRef a, StringRef b) { >- lld::outs() << left_justify(a, 49) << " " << b << "\n"; >+static void print(raw_ostream &os, StringRef a, StringRef b) { >+ os << left_justify(a, 49) << " " << b << "\n"; > } > > // Output a cross reference table to stdout. This is for --cref. >@@ -231,6 +231,14 @@ > if (!config->cref) > return; > >+ std::string outfile = config->mapFile.empty() ? "-" : config->mapFile; >+ std::error_code ec; >+ raw_fd_ostream os(outfile, ec, sys::fs::OF_Append); >+ if (ec) { >+ error("cannot open " + outfile + ": " + ec.message()); >+ return; >+ } >+ > // Collect symbols and files. > MapVector<Symbol *, SetVector<InputFile *>> map; > for (InputFile *file : objectFiles) { >@@ -244,18 +252,18 @@ > } > > // Print out a header. >- lld::outs() << "Cross Reference Table\n\n"; >- print("Symbol", "File"); >+ os << "Cross Reference Table\n\n"; >+ print(os, "Symbol", "File"); > > // Print out a table. > for (auto kv : map) { > Symbol *sym = kv.first; > SetVector<InputFile *> &files = kv.second; > >- print(toString(*sym), toString(sym->file)); >+ print(os, toString(*sym), toString(sym->file)); > for (InputFile *file : files) > if (file != sym->file) >- print("", toString(file)); >+ print(os, "", toString(file)); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251251
: 219921