Skip to content

Commit d91cc7b

Browse files
authored
[Downstream change] Implement Arm Toolchain ID (#126)
Since there are potentially different versions of the toolchain that can be built (e.g. Arm Toolchain for Embedded and Arm Toolchain for Linux), we need a way to uniquely identify the toolchain from the version output, and differentiate from the upstream version. This can be done by appending an additional message: `Arm Toolchain ID: tag.` The contents of the tag will need to be generated by the product's build script. This patch add the field to version output, which can be set by the CMake option ARM_TOOLCHAIN_ID when building the toolchain. Clang and clang-format have their own version functions, whereas the other LLVM tools use a shared utility function. This patch appends the new message into both. --- Downstream issue: #124
1 parent ec5ed34 commit d91cc7b

File tree

7 files changed

+24
-0
lines changed

7 files changed

+24
-0
lines changed

clang/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION
334334
set(MAX_CLANG_ABI_COMPAT_VERSION "${LLVM_VERSION_MAJOR}")
335335
message(STATUS "Clang version: ${CLANG_VERSION}")
336336

337+
# Downstream change issue: #124 (Arm Toolchain ID)
338+
if(NOT DEFINED ARM_TOOLCHAIN_ID)
339+
set(ARM_TOOLCHAIN_ID "unset")
340+
endif()
341+
# End downstream change: #124
342+
337343
# Configure the Version.inc file.
338344
configure_file(
339345
${CMAKE_CURRENT_SOURCE_DIR}/include/clang/Basic/Version.inc.in

clang/include/clang/Basic/Version.inc.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
#define CLANG_VERSION_MINOR @CLANG_VERSION_MINOR@
66
#define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@
77
#define MAX_CLANG_ABI_COMPAT_VERSION @MAX_CLANG_ABI_COMPAT_VERSION@
8+
// Downstream change issue: #124 (Arm Toolchain ID)
9+
#define ARM_TOOLCHAIN_ID "@ARM_TOOLCHAIN_ID@"

clang/lib/Driver/Driver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,9 @@ void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {
23252325
// If configuration files were used, print their paths.
23262326
for (auto ConfigFile : ConfigFiles)
23272327
OS << "Configuration file: " << ConfigFile << '\n';
2328+
2329+
// Downstream change issue: #124 (Arm Toolchain ID)
2330+
OS << "Arm Toolchain ID: " << ARM_TOOLCHAIN_ID << '\n';
23282331
}
23292332

23302333
/// PrintDiagnosticCategories - Implement the --print-diagnostic-categories

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
554554

555555
static void PrintVersion(raw_ostream &OS) {
556556
OS << clang::getClangToolFullVersion("clang-format") << '\n';
557+
// Downstream change issue: #124 (Arm Toolchain ID)
558+
OS << "Arm Toolchain ID: " << ARM_TOOLCHAIN_ID << '\n';
557559
}
558560

559561
// Dump the configuration.

llvm/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,12 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "")
11641164

11651165
endif()
11661166

1167+
# Downstream change issue: #124 (Arm Toolchain ID)
1168+
if(NOT DEFINED ARM_TOOLCHAIN_ID)
1169+
set(ARM_TOOLCHAIN_ID "unset")
1170+
endif()
1171+
# End downstream change: #124
1172+
11671173
# Configure the three LLVM configuration header files.
11681174
configure_file(
11691175
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake

llvm/include/llvm/Config/config.h.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,4 +297,7 @@
297297

298298
#cmakedefine HAVE_GETAUXVAL ${HAVE_GETAUXVAL}
299299

300+
/* Downstream change issue: #124 (Arm Toolchain ID) */
301+
#cmakedefine ARM_TOOLCHAIN_ID "${ARM_TOOLCHAIN_ID}"
302+
300303
#endif

llvm/lib/Support/CommandLine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,8 @@ class VersionPrinter {
25402540
OS << " with assertions";
25412541
#endif
25422542
OS << ".\n";
2543+
// Downstream change issue: #124 (Arm Toolchain ID)
2544+
OS << "Arm Toolchain ID: " << ARM_TOOLCHAIN_ID << '\n';
25432545

25442546
// Iterate over any registered extra printers and call them to add further
25452547
// information.

0 commit comments

Comments
 (0)