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

add support for .data.rel.ro and absolute relocations to surgical linker #3623

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 5 additions & 1 deletion crates/linker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2540,7 +2540,10 @@ pub fn surgery_elf(
// in development builds for caching the results of top-level constants
let rodata_sections: Vec<Section> = app_obj
.sections()
.filter(|sec| sec.name().unwrap_or_default().starts_with(".rodata"))
.filter(|sec| {
sec.name().unwrap_or_default().starts_with(".rodata")
|| sec.name().unwrap_or_default().starts_with(".data.rel.ro")
})
.collect();

// bss section is like rodata section, but it has zero file size and non-zero virtual size.
Expand Down Expand Up @@ -2683,6 +2686,7 @@ pub fn surgery_elf(
RelocationKind::Relative | RelocationKind::PltRelative => {
target_offset - virt_base as i64 + rel.1.addend()
}
RelocationKind::Absolute => target_offset + rel.1.addend(),
x => {
internal_error!("Relocation Kind not yet support: {:?}", x);
}
Expand Down