Skip to content

Commit

Permalink
Read elf symbol bind as visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed May 20, 2024
1 parent f0b2c0e commit b06c64e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add `visibility` attribute to symbols.
- Allows to specify custom visibility, like `weak` or `local`, to each symbol.
- Read symbol binding from elf files as `visibility` automatically.

## [1.25.1] - 2024-05-03

Expand Down
4 changes: 4 additions & 0 deletions spimdisasm/elfObjDisasm/ElfObjDisasmInternals.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ def insertSymtabIntoContext(context: common.Context, symbolTable: elf32.Elf32Sym
if contextSym is not None:
contextSym.sectionType = sectType

bind = elf32.Elf32SymbolTableBinding.fromValue(symEntry.stBind)
if bind is not None:
contextSym.visibility = bind.name

def insertDynsymIntoContext(context: common.Context, symbolTable: elf32.Elf32Syms, stringTable: elf32.Elf32StringTable) -> None:
for symEntry in symbolTable:
if symEntry.value == 0 or symEntry.shndx == 0:
Expand Down

0 comments on commit b06c64e

Please sign in to comment.