From 566b084c24ebac59219d73417fb024d6e4609c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= Date: Mon, 15 Jan 2024 21:36:07 +0100 Subject: [PATCH] Add "used" attribute to XML data symbol when creating compressed config 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) {