mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
allow surgical linker to work without any rodata section
This commit is contained in:
parent
2294f6994f
commit
75c290273d
1 changed files with 17 additions and 9 deletions
|
@ -1364,15 +1364,6 @@ fn surgery_elf_help(
|
||||||
println!("Found App Function Symbols: {:+x?}", app_func_vaddr_map);
|
println!("Found App Function Symbols: {:+x?}", app_func_vaddr_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (new_rodata_section_offset, new_rodata_section_vaddr) = rodata_sections
|
|
||||||
.iter()
|
|
||||||
.map(|sec| section_offset_map.get(&sec.index()).unwrap())
|
|
||||||
.min()
|
|
||||||
.unwrap();
|
|
||||||
let (new_rodata_section_offset, new_rodata_section_vaddr) = (
|
|
||||||
*new_rodata_section_offset as u64,
|
|
||||||
*new_rodata_section_vaddr as u64,
|
|
||||||
);
|
|
||||||
let (new_text_section_offset, new_text_section_vaddr) = text_sections
|
let (new_text_section_offset, new_text_section_vaddr) = text_sections
|
||||||
.iter()
|
.iter()
|
||||||
.map(|sec| section_offset_map.get(&sec.index()).unwrap())
|
.map(|sec| section_offset_map.get(&sec.index()).unwrap())
|
||||||
|
@ -1399,6 +1390,23 @@ fn surgery_elf_help(
|
||||||
*new_bss_section_vaddr as u64,
|
*new_bss_section_vaddr as u64,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// rodata section is not guaranteed to exist.
|
||||||
|
// If it doesn't exist, just use the bss section offset.
|
||||||
|
// This will make a rodata section of size 0.
|
||||||
|
let rodata_default = (
|
||||||
|
new_bss_section_offset as usize,
|
||||||
|
new_bss_section_vaddr as usize,
|
||||||
|
);
|
||||||
|
let (new_rodata_section_offset, new_rodata_section_vaddr) = rodata_sections
|
||||||
|
.iter()
|
||||||
|
.map(|sec| section_offset_map.get(&sec.index()).unwrap())
|
||||||
|
.min()
|
||||||
|
.unwrap_or(&rodata_default);
|
||||||
|
let (new_rodata_section_offset, new_rodata_section_vaddr) = (
|
||||||
|
*new_rodata_section_offset as u64,
|
||||||
|
*new_rodata_section_vaddr as u64,
|
||||||
|
);
|
||||||
|
|
||||||
// Move data and deal with relocations.
|
// Move data and deal with relocations.
|
||||||
for sec in rodata_sections
|
for sec in rodata_sections
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue