Merge pull request #2558 from cfallin/pic-symbol-refs

x64: support PC-rel symbol references using the GOT when in PIC mode.
This commit is contained in:
Chris Fallin
2021-01-08 10:03:10 -08:00
committed by GitHub
3 changed files with 82 additions and 12 deletions

View File

@@ -397,7 +397,10 @@ pub enum Inst {
/// An instruction that will always trigger the illegal instruction exception.
Ud2 { trap_code: TrapCode },
/// Loads an external symbol in a register, with a relocation: movabsq $name, dst
/// Loads an external symbol in a register, with a relocation:
///
/// movq $name@GOTPCREL(%rip), dst if PIC is enabled, or
/// movabsq $name, dst otherwise.
LoadExtName {
dst: Writable<Reg>,
name: Box<ExternalName>,
@@ -1726,7 +1729,7 @@ impl PrettyPrint for Inst {
dst, name, offset, ..
} => format!(
"{} {}+{}, {}",
ljustify("movaps".into()),
ljustify("load_ext_name".into()),
name,
offset,
show_ireg_sized(dst.to_reg(), mb_rru, 8),