From 51c22d3b8bc7893c66d6e622b3d6ac18ffc9f6c3 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 20 Jan 2022 13:39:14 +0700 Subject: [PATCH 1/2] tools: GCC 11 uses both '.debug_line_str' and '.debug_str' sections --- tools/idf_size.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/idf_size.py b/tools/idf_size.py index 806c788c06..bfac433f80 100755 --- a/tools/idf_size.py +++ b/tools/idf_size.py @@ -381,9 +381,7 @@ def load_sections(map_file: TextIO) -> Dict: if srcs: last_src = srcs[-1] if last_src['size'] > 0 and last_src['address'] == int(match_line.group('address'), 16): - if '.comment' != section['name'] and '.debug_str' != section['name'] and\ - 'rodata' not in last_src['sym_name']: - + if section['name'] not in ['.comment', '.debug_str', '.debug_line_str'] and 'rodata' not in last_src['sym_name']: raise RuntimeError('Due to overlap with following lines, size of the line set to 0:\n %s' % dump_src_line(last_src)) last_src['size'] = 0 From 9cc2ce9f7c7dc2ad1a22d739babb355a121dd82a Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 20 Jan 2022 13:40:46 +0700 Subject: [PATCH 2/2] build: fallback to dwarf-4 format because of lesser binary size (dwarf-5 is by default in GCC 11) --- tools/cmake/build.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/cmake/build.cmake b/tools/cmake/build.cmake index 19944d878e..43d78d9803 100644 --- a/tools/cmake/build.cmake +++ b/tools/cmake/build.cmake @@ -103,6 +103,9 @@ function(__build_set_default_build_specifications) "-Wextra" "-Wno-unused-parameter" "-Wno-sign-compare" + # Default is dwarf-5 since GCC 11, fallback to dwarf-4 because of binary size + # TODO: IDF-5160 + "-gdwarf-4" # always generate debug symbols (even in release mode, these don't # go into the final binary so have no impact on size "-ggdb")