mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
improve calculation of section index
This commit is contained in:
parent
1c8b717af4
commit
56bf57dab1
1 changed files with 5 additions and 4 deletions
|
@ -73,10 +73,6 @@ pub(crate) fn preprocess_windows(
|
|||
let new_sections = [*b".text\0\0\0", *b".rdata\0\0"];
|
||||
increase_number_of_sections_help(&data, &new_sections, out_filename);
|
||||
|
||||
use object::ObjectSection;
|
||||
let last_host_section_index = exec_obj.sections().count() - 2; // we add 2 sections
|
||||
let last_host_section = exec_obj.sections().nth(last_host_section_index).unwrap();
|
||||
|
||||
let exec_data = std::fs::read(out_filename).unwrap();
|
||||
let exec_data = exec_data.as_slice();
|
||||
let exec_obj = match object::read::pe::PeFile64::parse(exec_data) {
|
||||
|
@ -86,6 +82,11 @@ pub(crate) fn preprocess_windows(
|
|||
}
|
||||
};
|
||||
|
||||
use object::ObjectSection;
|
||||
// -2 because we added 2 sections, -1 because we have a count and want an index
|
||||
let last_host_section_index = exec_obj.sections().count() - 2 - 1;
|
||||
let last_host_section = exec_obj.sections().nth(last_host_section_index).unwrap();
|
||||
|
||||
let dynamic_relocations = DynamicRelocationsPe::new(exec_data);
|
||||
let thunks_start_offset = find_thunks_start_offset(exec_data, &dynamic_relocations);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue