scripts: logging: support native_posix dictionary logging

- Do not look CONFIG_* symbols from dynamic symbols which might
  be there before the symbol table where CONFIG_* symbols are found.

- Define posix architecture in ARCHS list.

- Check if architecture is not found instead of letting the code
  run into trying to access dictionary with None key.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
This commit is contained in:
Miika Karanki 2024-04-10 11:57:10 +03:00 committed by Carles Cufí
parent b292a9e8b5
commit 67de8d58ec
2 changed files with 7 additions and 1 deletions

View file

@ -143,7 +143,7 @@ def find_elf_sections(elf, sh_name):
def get_kconfig_symbols(elf):
"""Get kconfig symbols from the ELF file"""
for section in elf.iter_sections():
if isinstance(section, SymbolTableSection):
if isinstance(section, SymbolTableSection) and section['sh_type'] != 'SHT_DYNSYM':
return {sym.name: sym.entry.st_value
for sym in section.iter_symbols()
if sym.name.startswith("CONFIG_")}
@ -254,6 +254,9 @@ def process_kconfigs(elf, database):
if arch['kconfig'] in kconfigs:
database.set_arch(name)
break
else:
logger.error("Did not found architecture")
sys.exit(1)
# Put some kconfigs into the database
#

View file

@ -46,6 +46,9 @@ ARCHS = {
# for explanation.
"extra_string_section": ['datas'],
},
"posix" : {
"kconfig": "CONFIG_ARCH_POSIX",
},
"riscv" : {
"kconfig": "CONFIG_RISCV",
},