Skip to content

Commit 317b598

Browse files
committed
[Downstream change] Implement Arm Toolchain ID (arm#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: arm#124 (cherry picked from commit d91cc7b)
1 parent 200e90e commit 317b598

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
@@ -2277,6 +2277,9 @@ void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {
22772277
// If configuration files were used, print their paths.
22782278
for (auto ConfigFile : ConfigFiles)
22792279
OS << "Configuration file: " << ConfigFile << '\n';
2280+
2281+
// Downstream change issue: #124 (Arm Toolchain ID)
2282+
OS << "Arm Toolchain ID: " << ARM_TOOLCHAIN_ID << '\n';
22802283
}
22812284

22822285
/// 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
@@ -1158,6 +1158,12 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "")
11581158

11591159
endif()
11601160

1161+
# Downstream change issue: #124 (Arm Toolchain ID)
1162+
if(NOT DEFINED ARM_TOOLCHAIN_ID)
1163+
set(ARM_TOOLCHAIN_ID "unset")
1164+
endif()
1165+
# End downstream change: #124
1166+
11611167
# Configure the three LLVM configuration header files.
11621168
configure_file(
11631169
${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
@@ -295,4 +295,7 @@
295295

296296
#cmakedefine HAVE_BUILTIN_THREAD_POINTER ${HAVE_BUILTIN_THREAD_POINTER}
297297

298+
/* Downstream change issue: #124 (Arm Toolchain ID) */
299+
#cmakedefine ARM_TOOLCHAIN_ID "${ARM_TOOLCHAIN_ID}"
300+
298301
#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)