Skip to content
Open
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
14 changes: 12 additions & 2 deletions lib/Target/GNULDBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4952,9 +4952,19 @@ LDSymbol *GNULDBackend::canProvideSymbol(llvm::StringRef symName) {
void GNULDBackend::makeVersionString() {
if (!m_pComment)
return;
std::string VersionString = std::string(eld::getVendorName()) + " Linker ";
std::string VersionString = "Linker: ";
if (!eld::getVendorName().empty()) {
VersionString += eld::getVendorName().str();
VersionString += " ";
}
VersionString += "ELD ";
VersionString += eld::getELDVersion();
VersionString += " (" + eld::getELDRevision().str() + ")";

const std::string ELDRepositoryVersion = eld::getELDRepositoryVersion();
if (!ELDRepositoryVersion.empty()) {
VersionString += " ";
VersionString += ELDRepositoryVersion;
}
if (m_Module.needLTOToBeInvoked() || config().options().hasLTO())
VersionString += " LTO Enabled ";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the LTO enabled from the version output.

Fragment *F = make<StringFragment>(VersionString, m_pComment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.1.o
RUN: %link %linkopts %t1.1.o -o %t1.1.out
RUN: %readelf -p .comment %t1.1.out 2>&1 2>&1 | %filecheck %s
#CHECK: Linker {{.*}} ({{.*}})
#CHECK: Linker: {{.*}}ELD {{.*}} ({{.*}})
#CHECK: {{(LLVM .* \(.*\))?}}
#END_TEST
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN: %filecheck %s < %t1.1.revision_info.txt
RUN: %git -C %eldsrcroot reset HEAD~
RUN: %cmake --build %llvmobjroot --target ld.eld 1>/dev/null 2>&1
RUN: %not %diff %t1.1.revision_info.txt %t1.2.revision_info.txt 2>&1 | %filecheck %s --check-prefix=DIFF
#CHECK: Linker {{.*}} ({{.*}})
#CHECK: Linker: {{.*}}ELD {{.*}} ({{.*}})
#CHECK: {{(LLVM .* \(.*\))?}}
#DIFF: 3c3
#END_TEST
4 changes: 2 additions & 2 deletions test/Common/standalone/LinkerComment/LinkerComment.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN: %readelf -S -W -p .comment %t2.out.lto.dso | %filecheck %s -check-prefix LT
RUN: %readelf -S -W -p .comment %t2.out.lto.pie | %filecheck %s -check-prefix LTO

#CHECK: .comment {{.*}} 01
#CHECK: Linker
#CHECK: Linker: {{.*}}ELD
#LTO: .comment {{.*}} 01
#LTO: LTO Enabled
#LTO: Linker: {{.*}}ELD{{.*}}LTO Enabled
#END_TEST
Loading