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

decoder: Ignore AArch64 mapping symbols #775

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- [#775]: `defmt-decoder`: Ignore AArch64 mapping symbols
- [#771]: `defmt-macros`: Ignore empty items in DEFMT_LOG

[#775]: https://github.com/knurling-rs/defmt/pull/775
[#771]: https://github.com/knurling-rs/defmt/pull/771

## defmt-decoder v0.3.8, defmt-print v0.3.8 - 2023-08-01
Expand Down
18 changes: 13 additions & 5 deletions decoder/src/elf2table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,21 @@ pub fn parse_impl(elf: &[u8], check_version: bool) -> Result<Option<Table>, anyh
let mut bitflags_map = HashMap::new();
let mut timestamp = None;
for entry in elf.symbols() {
// Skipping symbols with empty string names, as they may be added by
// `objcopy`, and breaks JSON demangling
let name = match entry.name() {
Ok(name) if !name.is_empty() => name,
_ => continue,
let Ok(name) = entry.name() else {
continue;
};

if name.is_empty() {
// Skipping symbols with empty string names, as they may be added by
// `objcopy`, and breaks JSON demangling
continue;
}

if name == "$d" || name.starts_with("$d.") {
// Skip AArch64 mapping symbols
continue;
}

if name.starts_with("_defmt") || name.starts_with("__DEFMT_MARKER") {
// `_defmt_version_` is not a JSON encoded `defmt` symbol / log-message; skip it
// LLD and GNU LD behave differently here. LLD doesn't include `_defmt_version_`
Expand Down
Loading