Skip to content

Commit

Permalink
Get vtor from 0x20000000 for SRAM binaries, and use rwd where present
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Nov 20, 2024
1 parent 09caa67 commit 67d7434
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4613,9 +4613,14 @@ void sign_guts_elf(elf_file* elf, private_t private_key, public_t public_key) {
std::shared_ptr<entry_point_item> entry_point = new_block.get_item<entry_point_item>();
if (entry_point == nullptr) {
std::shared_ptr<vector_table_item> vtor = new_block.get_item<vector_table_item>();
uint32_t vtor_loc = 0x10000000;
uint32_t vtor_loc = elf->header().entry < SRAM_START ? 0x10000000 : 0x20000000;
if (vtor != nullptr) {
vtor_loc = vtor->addr;
} else {
std::shared_ptr<rolling_window_delta_item> rwd = new_block.get_item<rolling_window_delta_item>();
if (rwd != nullptr) {
vtor_loc += rwd->addr;
}
}
auto segment = elf->segment_from_physical_address(vtor_loc);
auto content = elf->content(*segment);
Expand Down

0 comments on commit 67d7434

Please sign in to comment.