MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / process_reloc

Method process_reloc

cranelift/object/src/backend.rs:852–1117  ·  view source on GitHub ↗
(&self, record: &ModuleReloc)

Source from the content-addressed store, hash-verified

850 }
851
852 fn process_reloc(&self, record: &ModuleReloc) -> ObjectRelocRecord {
853 let flags = match record.kind {
854 Reloc::Abs4 => RelocationFlags::Generic {
855 kind: RelocationKind::Absolute,
856 encoding: RelocationEncoding::Generic,
857 size: 32,
858 },
859 Reloc::Abs8 => RelocationFlags::Generic {
860 kind: RelocationKind::Absolute,
861 encoding: RelocationEncoding::Generic,
862 size: 64,
863 },
864 Reloc::X86PCRel4 => RelocationFlags::Generic {
865 kind: RelocationKind::Relative,
866 encoding: RelocationEncoding::Generic,
867 size: 32,
868 },
869 Reloc::X86CallPCRel4 => RelocationFlags::Generic {
870 kind: RelocationKind::Relative,
871 encoding: RelocationEncoding::X86Branch,
872 size: 32,
873 },
874 // TODO: Get Cranelift to tell us when we can use
875 // R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX.
876 Reloc::X86CallPLTRel4 => RelocationFlags::Generic {
877 kind: RelocationKind::PltRelative,
878 encoding: RelocationEncoding::X86Branch,
879 size: 32,
880 },
881 Reloc::X86SecRel => RelocationFlags::Generic {
882 kind: RelocationKind::SectionOffset,
883 encoding: RelocationEncoding::Generic,
884 size: 32,
885 },
886 Reloc::X86GOTPCRel4 => RelocationFlags::Generic {
887 kind: RelocationKind::GotRelative,
888 encoding: RelocationEncoding::Generic,
889 size: 32,
890 },
891 Reloc::Arm64Call => RelocationFlags::Generic {
892 kind: RelocationKind::Relative,
893 encoding: RelocationEncoding::AArch64Call,
894 size: 26,
895 },
896 Reloc::ElfX86_64TlsGd => {
897 assert_eq!(
898 self.object.format(),
899 object::BinaryFormat::Elf,
900 "ElfX86_64TlsGd is not supported for this file format"
901 );
902 RelocationFlags::Elf {
903 r_type: object::elf::R_X86_64_TLSGD,
904 }
905 }
906 Reloc::MachOX86_64Tlv => {
907 assert_eq!(
908 self.object.format(),
909 object::BinaryFormat::MachO,

Callers 3

define_function_bytesMethod · 0.80
define_dataMethod · 0.80

Calls 2

formatMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected