Skip to content

Commit 3a8c20d

Browse files
taricarlescufi
authored andcommitted
build: don't assume .symtab section type
Only the elftools SymbolTableSection section type provides an iter_symbols() method, and compilers are free to emit sections that include the substring '.symtab' in their name which causes errors if gen_relocate_app examines only the section name. Instead check whether a section is a symbol table to skip attempting to inspect sections that are not actually symbol tables. Signed-off-by: Peter Marheine <[email protected]>
1 parent 0c198f9 commit 3a8c20d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/build/gen_relocate_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import glob
4242
import warnings
4343
from elftools.elf.elffile import ELFFile
44+
from elftools.elf.sections import SymbolTableSection
4445

4546
# This script will create linker commands for text,rodata data, bss section relocation
4647

@@ -180,7 +181,7 @@ def find_sections(filename, full_list_of_sections):
180181
# common symbols and warns the user of the problem.
181182
# The solution to which is simply assigning a 0 to
182183
# bss variable and it will go to the required place.
183-
if ".symtab" in section.name:
184+
if isinstance(section, SymbolTableSection):
184185
symbols = [x for x in section.iter_symbols()]
185186
for symbol in symbols:
186187
if symbol.entry["st_shndx"] == 'SHN_COMMON':

0 commit comments

Comments
 (0)