Repository navigation
[target/sim] Reset POSIX ELF loader state between files - #315
Open
lionelZhaowy wants to merge 1 commit into
Open
lionelZhaowy wants to merge 1 commit into
lionelZhaowy wants to merge 1 commit into
Conversation
Clear the previous image data and iterator when read_elf starts. Test real DPI open arrays with two ELF fixtures, repeated loads, an unconsumed iterator, an expected failed open, and recovery. Keep the non-POSIX implementation unchanged. AI assistance was used for code, tests, and text.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reloading an ELF with the POSIX implementation can return data from the previous file.
read_elfretains the section vector, address-to-bytes map, iterator, and entry point. A second ELF at the same address keeps the first payload becausemems.insertdoes not replace it. An unconsumed iterator can expose stale sections; a failed open keeps the old entry point.Clear the four per-file states when a new POSIX
read_elfcall starts. The non-POSIX implementation is unchanged. Keep the parser and DPI API unchanged. Add two minimal ELF fixtures and a real DPI open-array test.Validation on official main
6c6dd5e834347f72c7be31cd6c41021ec293c5b9: same two ELF files and test, seven successful loads, six iterator drains, one expected failed open, and recovery. Original: 954 checks / 291 errors and TEST_FAILED. Fixed: 823 checks / zero errors and normal finish at 1 ns. The original runs more checks because it exposes an extra stale segment. Both VCS builds pass with the same existing simulator-linker warning. The test checks each byte, entry, address, length, buffer guards, and iterator state. Public commands and input SHA256 values are intarget/sim/tests/elfloader_state/README.md.Tools: LLVM 20.1.0, VCS W-2024.09-SP1, GCC 13.3.1, Linux. This validates the actual host loader and simulator DPI API. It does not validate a SoC, BSS, ELF32, malformed input parsing, or the non-POSIX branch. Original authors and licenses remain. AI assistance was used for code, tests, and text. An independent AI review checked the actual results.