Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lld/COFF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2878,10 +2878,10 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
// Handle /call-graph-ordering-file and /call-graph-profile-sort (default on).
if (config->callGraphProfileSort) {
llvm::TimeTraceScope timeScope("Call graph");
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file)) {
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file))
parseCallGraphFile(arg->getValue());
}
readCallGraphsFromObjectFiles(ctx);
else
readCallGraphsFromObjectFiles(ctx);
}

// Handle /print-symbol-order.
Expand Down
5 changes: 3 additions & 2 deletions lld/ELF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3215,11 +3215,12 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {

// Read the callgraph now that we know what was gced or icfed
if (ctx.arg.callGraphProfileSort != CGProfileSortKind::None) {
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file))
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file)) {
if (std::optional<MemoryBufferRef> buffer =
readFile(ctx, arg->getValue()))
readCallGraph(ctx, *buffer);
readCallGraphsFromObjectFiles<ELFT>(ctx);
} else
readCallGraphsFromObjectFiles<ELFT>(ctx);
}

// Write the result to the file.
Expand Down
8 changes: 4 additions & 4 deletions lld/test/COFF/cgprofile-obj.s
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Aa:
# NO-CG: 140001002 T B
# NO-CG: 140001003 T A

# CG-OBJ-OF: 140001000 T C
# CG-OBJ-OF: 140001001 t D
# CG-OBJ-OF: 140001002 T A
# CG-OBJ-OF: 140001003 T B
# CG-OBJ-OF: 140001000 t D
# CG-OBJ-OF: 140001001 T A
# CG-OBJ-OF: 140001004 T C
# CG-OBJ-OF: 140001005 T B
8 changes: 4 additions & 4 deletions lld/test/ELF/cgprofile-obj.s
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Aa:
# NO-CG: 0000000000201122 T B
# NO-CG: 0000000000201123 T A

# CG-OBJ-OF: 0000000000201121 t D
# CG-OBJ-OF: 0000000000201120 T C
# CG-OBJ-OF: 0000000000201123 T B
# CG-OBJ-OF: 0000000000201122 T A
# CG-OBJ-OF: 0000000000201120 t D
# CG-OBJ-OF: 0000000000201124 T C
# CG-OBJ-OF: 0000000000201125 T B
# CG-OBJ-OF: 0000000000201121 T A
Loading