Align IntelGOTPCRel4 with R_X86_64_GOTPCREL.
Add an addend field to reloc_external, and use it to move the responsibility for accounting for the difference between the end of an instruction (where the PC is considered to be in PC-relative on intel) and the beginning of the immediate field into the encoding code. Specifically, this makes IntelGOTPCRel4 directly correspond to R_X86_64_GOTPCREL, instead of also carrying an implicit `- 4`.
This commit is contained in:
@@ -72,13 +72,29 @@ impl binemit::CodeSink for TextSink {
|
||||
write!(self.text, "{}({}) ", reloc, ebb_offset).unwrap();
|
||||
}
|
||||
|
||||
fn reloc_external(&mut self, reloc: binemit::Reloc, name: &ir::ExternalName) {
|
||||
fn reloc_external(
|
||||
&mut self,
|
||||
reloc: binemit::Reloc,
|
||||
name: &ir::ExternalName,
|
||||
addend: binemit::Addend,
|
||||
) {
|
||||
write!(
|
||||
self.text,
|
||||
"{}({}) ",
|
||||
"{}({}",
|
||||
reloc,
|
||||
name,
|
||||
).unwrap();
|
||||
if addend != 0 {
|
||||
write!(
|
||||
self.text,
|
||||
"{:+}",
|
||||
addend,
|
||||
).unwrap();
|
||||
}
|
||||
write!(
|
||||
self.text,
|
||||
") ",
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
fn reloc_jt(&mut self, reloc: binemit::Reloc, jt: ir::JumpTable) {
|
||||
|
||||
Reference in New Issue
Block a user