From f18d16d5e69d2b265ee77e82f81c550374224a6b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 15 Nov 2021 23:55:33 +0100 Subject: [PATCH] esp_common: don't generate custom sections when building for Linux When building for Linux, a standard linker script is used. Ignore all attributes related to custom sections. --- components/esp_common/include/esp_attr.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/esp_common/include/esp_attr.h b/components/esp_common/include/esp_attr.h index 84de204618..acd895c7be 100644 --- a/components/esp_common/include/esp_attr.h +++ b/components/esp_common/include/esp_attr.h @@ -147,9 +147,14 @@ FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a = a << b; return a; } // // Using unique sections also means --gc-sections can remove unused // data with a custom section type set +#ifndef CONFIG_IDF_TARGET_LINUX #define _SECTION_ATTR_IMPL(SECTION, COUNTER) __attribute__((section(SECTION "." _COUNTER_STRINGIFY(COUNTER)))) - #define _COUNTER_STRINGIFY(COUNTER) #COUNTER +#else +// Custom section attributes are generally not used in the port files for Linux target, but may be found +// in the common header files. Don't declare custom sections in that case. +#define _SECTION_ATTR_IMPL(SECTION, COUNTER) +#endif /* Use IDF_DEPRECATED attribute to mark anything deprecated from use in ESP-IDF's own source code, but not deprecated for external users.