Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elf2cfetbl does not handle files without a separate ".shstrtab" section #48

Closed
jphickey opened this issue Jul 2, 2020 · 0 comments · Fixed by #49 or #47
Closed

elf2cfetbl does not handle files without a separate ".shstrtab" section #48

jphickey opened this issue Jul 2, 2020 · 0 comments · Fixed by #49 or #47
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented Jul 2, 2020

Describe the bug
In ELF files all strings are put into string table sections (SHT_STRTAB type).

Many tools dedicate a separate STRTAB section specifically for the section names, with the number of this section indicated in the main ELF header e_shstrndx field.

However there is no requirement to put these strings in a separate table section. Some compilers generate a single STRTAB section containing all strings, section names and symbol names. In this case the ELF header e_shstrndx field points to this unified section.

To Reproduce
Pass an ELF table object file generated from clang compiler to elf2cfetbl - it fails to identify the symbol names correctly, and it therefore fails to find the CFE_TBL_FileDef symbol.

Expected behavior
elf2cfetbl should work with these ELF files and produce an output.

System observed on:
Ubuntu 20.04 (build host)

Additional context
Note that ELF also doesn't say any maximum number of string table sections either. There could be just one (this bug) or there could be more than two.

As best I can tell, the string table used for the .symtab section should always be named .strtab - so this is probably a better way to identify the right section.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey added the bug Something isn't working label Jul 2, 2020
jphickey added a commit to jphickey/elf2cfetbl that referenced this issue Jul 2, 2020
Support ELF files that have all strings, including ELF section names,
in one single ".strtab" section in the ELF file.

This gives preferential treatment to a section named ".strtab" as this
should always be the section which contains the names for the ".symtab"
section.

This should also be true of ELF files that contain other strtab sections,
such as a ".dynstr" section.
jphickey added a commit to jphickey/elf2cfetbl that referenced this issue Jul 2, 2020
Support ELF files that have all strings, including ELF section names,
in one single ".strtab" section in the ELF file.

This gives preferential treatment to a section named ".strtab" as this
should always be the section which contains the names for the ".symtab"
section.

This should also be true of ELF files that contain other strtab sections,
such as a ".dynstr" section.
astrogeco added a commit that referenced this issue Jul 8, 2020
Fix #48, string table identification.
@astrogeco astrogeco added this to the 3.2.0 milestone Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants