From feb641cdaad7227738bc9321954ec58677f1d234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= Date: Tue, 16 Jan 2024 23:41:24 +0100 Subject: [PATCH] Add "used" attribute to XML data symbol when creating compressed config (#346) The __attribute__((used)) tells the compiler not to make the symbol local when optimizing. This happens when LTO is used when building a VESC package. --- utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utility.cpp b/utility.cpp index 7999e46a9..ca7e45feb 100755 --- a/utility.cpp +++ b/utility.cpp @@ -1427,7 +1427,7 @@ bool Utility::createCompressedConfigC(ConfigParams *params, QString configName, outSource << "// This file is autogenerated by VESC Tool\n\n"; outSource << "#include \"" << headerInfo.fileName() << "\"\n\n"; - outSource << "uint8_t data_" << configNameStr << "[" << compressed.size() << "] = {\n\t"; + outSource << "__attribute__((used)) uint8_t data_" << configNameStr << "[" << compressed.size() << "] = {\n\t"; int posCnt = 0; for (auto b: compressed) {