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

fix(mem): Fix elf loading byte counting #505

Merged
Merged
Changes from all 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
5 changes: 4 additions & 1 deletion src/test/csrc/common/elfloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,8 @@ long readFromElf(void *ptr, const char *file_name, long buf_size) {
std::memcpy((uint8_t *)ptr + offset, section.data_src, section.data_len);
len_written += len;
}
return len_written;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this len_written still used?

// Since we are unpacking the sections, the total amount of bytes is the last
// section offset plus its size.
auto last_section = elf_file.sections.back();
return last_section.data_dst - base_addr + last_section.data_len + last_section.zero_len;
}