Skip to content

parse_llvm_nm_symbols: when symbol name contains ":" character error occurs #15325

Closed
@SageWu

Description

@SageWu

emsdk version: 2.0.31
in /emsdk/upstream/emscripten/tools/building.py
parse_llvm_nm_symbols function
When the symbol contains ":" character the entry_pos variable will be wrong value. And that result in line[entry_pos + 13:] access wrong index.

error stack:

Traceback (most recent call last):
  File "*/emsdk/upstream/emscripten/em++.py", line 14, in <module>
    sys.exit(emcc.run(sys.argv))
  File "*/emsdk/upstream/emscripten/emcc.py", line 1091, in run
    phase_calculate_system_libraries(state, linker_arguments, linker_inputs, newargs)
  File "*/emsdk/python/3.9.2-1_64bit/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "*/emsdk/upstream/emscripten/emcc.py", line 2487, in phase_calculate_system_libraries
    extra_files_to_link += system_libs.calculate([f for _, f in sorted(linker_inputs)] + extra_files_to_link, forced=state.forced_stdlibs)
  File "*/emsdk/upstream/emscripten/tools/system_libs.py", line 1535, in calculate
    handle_reverse_deps(input_files)
  File "*/emsdk/upstream/emscripten/tools/system_libs.py", line 1506, in handle_reverse_deps
    symbolses = building.llvm_nm_multiple([os.path.abspath(t) for t in input_files])
  File "*/emsdk/python/3.9.2-1_64bit/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "*/emsdk/upstream/emscripten/tools/building.py", line 195, in llvm_nm_multiple
    for key, value in parse_llvm_nm_symbols(results.stdout).items():
  File "*/emsdk/upstream/emscripten/tools/building.py", line 566, in parse_llvm_nm_symbols
    status = line[entry_pos + 11] # Skip address, which is always fixed-length 8 chars.
IndexError: string index out of range

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions