From 907589fb58f8f1a740c9673dbf2aa6ba8ccdc1c4 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 23 Feb 2017 10:29:25 +0000 Subject: [PATCH 1/8] satman: simplify Makefile. --- artiq/firmware/satman/Makefile | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/artiq/firmware/satman/Makefile b/artiq/firmware/satman/Makefile index 576d69310..703490663 100644 --- a/artiq/firmware/satman/Makefile +++ b/artiq/firmware/satman/Makefile @@ -1,26 +1,15 @@ include ../include/generated/variables.mak include $(MISOC_DIRECTORY)/software/common.mak -PYTHON ?= python3 +LDFLAGS += -L../libbase -RUSTOUT := cargo/or1k-unknown-none/debug - -LDFLAGS += --gc-sections \ - -L../libbase - -RUSTFLAGS = \ - -C target-feature=+mul,+div,+ffl1,+cmov,+addc \ - -C opt-level=s \ - -C panic=abort -export RUSTFLAGS +RUSTFLAGS += -Cpanic=abort all: satman.bin satman.fbi .PHONY: $(RUSTOUT)/libsatman.a $(RUSTOUT)/libsatman.a: - CARGO_TARGET_DIR=$(realpath .)/cargo \ - cargo build --target=or1k-unknown-none \ - --manifest-path $(realpath $(SATMAN_DIRECTORY))/Cargo.toml + $(cargo) --manifest-path $(SATMAN_DIRECTORY)/Cargo.toml satman.elf: $(RUSTOUT)/libsatman.a $(LD) $(LDFLAGS) -T $(SATMAN_DIRECTORY)/satman.ld -o $@ $^ @@ -34,7 +23,7 @@ satman.elf: $(RUSTOUT)/libsatman.a @echo " MSCIMG " $@ && $(PYTHON) -m misoc.tools.mkmscimg -f -o $@ $< clean: - $(RM) satman.elf satman.bin satman.fbi .*~ *~ + $(RM) satman.elf satman.bin satman.fbi $(RM) -rf cargo .PHONY: all clean From 04ad2670555751b04604b3069c8a90550a513f37 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 24 Feb 2017 18:57:29 +0000 Subject: [PATCH 2/8] firmware: rewrite the dynamic linker in Rust. --- artiq/firmware/Cargo.lock | 6 + artiq/firmware/ksupport/Cargo.toml | 1 + artiq/firmware/ksupport/Makefile | 5 +- artiq/firmware/ksupport/api.rs | 7 +- artiq/firmware/ksupport/dyld.rs | 56 - artiq/firmware/ksupport/lib.rs | 20 +- artiq/firmware/libdyld/Cargo.toml | 8 + artiq/firmware/libdyld/elf.rs | 2737 ++++++++++++++++++++++++ artiq/firmware/libdyld/lib.rs | 313 +++ artiq/firmware/runtime/Cargo.toml | 1 + artiq/firmware/runtime/kernel_proto.rs | 3 +- artiq/firmware/runtime/lib.rs | 1 + artiq/firmware/runtime/session.rs | 2 +- 13 files changed, 3087 insertions(+), 73 deletions(-) delete mode 100644 artiq/firmware/ksupport/dyld.rs create mode 100644 artiq/firmware/libdyld/Cargo.toml create mode 100644 artiq/firmware/libdyld/elf.rs create mode 100644 artiq/firmware/libdyld/lib.rs diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index 220b2f394..38e74d84f 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -62,6 +62,10 @@ dependencies = [ "std_artiq 0.0.0", ] +[[package]] +name = "dyld" +version = "0.0.0" + [[package]] name = "fringe" version = "1.1.0" @@ -93,6 +97,7 @@ dependencies = [ "build_artiq 0.0.0", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dyld 0.0.0", "std_artiq 0.0.0", ] @@ -136,6 +141,7 @@ dependencies = [ "compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins?rev=631b568)", "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "drtioaux 0.0.0", + "dyld 0.0.0", "fringe 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "logger_artiq 0.0.0", diff --git a/artiq/firmware/ksupport/Cargo.toml b/artiq/firmware/ksupport/Cargo.toml index f8e8a4e4b..e0604d5eb 100644 --- a/artiq/firmware/ksupport/Cargo.toml +++ b/artiq/firmware/ksupport/Cargo.toml @@ -16,5 +16,6 @@ build_artiq = { path = "../libbuild_artiq" } alloc_none = { path = "../liballoc_none" } std_artiq = { path = "../libstd_artiq" } board = { path = "../libboard" } +dyld = { path = "../libdyld" } byteorder = { version = "1.0", default-features = false } cslice = { version = "0.3" } diff --git a/artiq/firmware/ksupport/Makefile b/artiq/firmware/ksupport/Makefile index e4f50e38c..47a58f2fe 100644 --- a/artiq/firmware/ksupport/Makefile +++ b/artiq/firmware/ksupport/Makefile @@ -11,8 +11,7 @@ LDFLAGS += --eh-frame-hdr \ -L../libcompiler-rt \ -L../libbase \ -L../libm \ - -L../libunwind \ - -L../libdyld + -L../libunwind RUSTFLAGS += -Cpanic=unwind @@ -24,7 +23,7 @@ $(RUSTOUT)/libksupport.a: ksupport.elf: $(RUSTOUT)/libksupport.a glue.o $(LD) $(LDFLAGS) -T $(KSUPPORT_DIRECTORY)/ksupport.ld -o $@ $^ \ - -lbase -lm -lcompiler-rt -ldyld -lunwind + -lbase -lm -lcompiler-rt -lunwind @chmod -x $@ %.o: $(KSUPPORT_DIRECTORY)/%.c diff --git a/artiq/firmware/ksupport/api.rs b/artiq/firmware/ksupport/api.rs index ce07c5aa4..b01a8a60f 100644 --- a/artiq/firmware/ksupport/api.rs +++ b/artiq/firmware/ksupport/api.rs @@ -12,12 +12,11 @@ macro_rules! api { } } -pub fn resolve(required: &str) -> usize { +pub fn resolve(required: &[u8]) -> Option { unsafe { API.iter() - .find(|&&(exported, _)| exported == required) - .map(|&(_, ptr)| ptr as usize) - .unwrap_or(0) + .find(|&&(exported, _)| exported.as_bytes() == required) + .map(|&(_, ptr)| ptr as u32) } } diff --git a/artiq/firmware/ksupport/dyld.rs b/artiq/firmware/ksupport/dyld.rs deleted file mode 100644 index c73653a19..000000000 --- a/artiq/firmware/ksupport/dyld.rs +++ /dev/null @@ -1,56 +0,0 @@ -use core::{ptr, slice, str}; -use libc::{c_void, c_char, c_int, size_t}; - -#[allow(non_camel_case_types)] -#[repr(C)] -#[derive(Default)] -struct dyld_info { - __opaque: [usize; 7] -} - -extern { - fn dyld_load(shlib: *const c_void, base: usize, - resolve: extern fn(*mut c_void, *const c_char) -> usize, - resolve_data: *mut c_void, - info: *mut dyld_info, error_out: *mut *const c_char) -> c_int; - fn dyld_lookup(symbol: *const c_char, info: *const dyld_info) -> *const c_void; - - fn strlen(ptr: *const c_char) -> size_t; -} - -pub struct Library { - lower: dyld_info -} - -impl Library { - pub unsafe fn load(shlib: &[u8], base: usize, mut resolve: F) - -> Result - where F: Fn(&str) -> usize { - extern fn wrapper(data: *mut c_void, name: *const c_char) -> usize - where F: Fn(&str) -> usize { - unsafe { - let f = data as *mut F; - let name = slice::from_raw_parts(name as *const u8, strlen(name)); - (*f)(str::from_utf8_unchecked(name)) - } - } - - let mut library = Library { lower: dyld_info::default() }; - let mut error: *const c_char = ptr::null(); - if dyld_load(shlib.as_ptr() as *const _, base, - wrapper::, &mut resolve as *mut _ as *mut _, - &mut library.lower, &mut error) == 0 { - let error = slice::from_raw_parts(error as *const u8, strlen(error)); - Err(str::from_utf8_unchecked(error)) - } else { - Ok(library) - } - } - - pub unsafe fn lookup(&self, symbol: &str) -> usize { - assert!(symbol.len() < 32); - let mut buf = [0u8; 32]; - buf[0..symbol.as_bytes().len()].copy_from_slice(symbol.as_bytes()); - dyld_lookup(&buf as *const _ as *const c_char, &self.lower) as usize - } -} diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index 944aa1183..034e53f8b 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -9,6 +9,7 @@ extern crate libc; extern crate byteorder; extern crate board; extern crate cslice; +extern crate dyld; #[path = "../runtime/mailbox.rs"] mod mailbox; @@ -20,10 +21,9 @@ mod kernel_proto; #[path = "../runtime/rpc_proto.rs"] mod rpc_proto; -mod dyld; mod api; -use core::{mem, ptr, str}; +use core::{mem, ptr, slice, str}; use std::io::Cursor; use cslice::{CSlice, AsCSlice}; use kernel_proto::*; @@ -294,8 +294,12 @@ unsafe fn attribute_writeback(typeinfo: *const ()) { #[no_mangle] pub unsafe fn main() { + let image = slice::from_raw_parts_mut(kernel_proto::KERNELCPU_PAYLOAD_ADDRESS as *mut u8, + kernel_proto::KERNELCPU_LAST_ADDRESS - + kernel_proto::KERNELCPU_PAYLOAD_ADDRESS); + let library = recv!(&LoadRequest(library) => { - match Library::load(library, kernel_proto::KERNELCPU_PAYLOAD_ADDRESS, api::resolve) { + match Library::load(library, image, &api::resolve) { Err(error) => { send(&LoadReply(Err(error))); loop {} @@ -307,16 +311,16 @@ pub unsafe fn main() { } }); - let __bss_start = library.lookup("__bss_start"); - let _end = library.lookup("_end"); - ptr::write_bytes(__bss_start as *mut u8, 0, _end - __bss_start); + let __bss_start = library.lookup(b"__bss_start").unwrap(); + let _end = library.lookup(b"_end").unwrap(); + ptr::write_bytes(__bss_start as *mut u8, 0, (_end - __bss_start) as usize); send(&NowInitRequest); recv!(&NowInitReply(now) => NOW = now); - (mem::transmute::(library.lookup("__modinit__")))(); + (mem::transmute::(library.lookup(b"__modinit__").unwrap()))(); send(&NowSave(NOW)); - attribute_writeback(library.lookup("typeinfo") as *const ()); + attribute_writeback(library.lookup(b"typeinfo").unwrap_or(0) as *const ()); send(&RunFinished); diff --git a/artiq/firmware/libdyld/Cargo.toml b/artiq/firmware/libdyld/Cargo.toml new file mode 100644 index 000000000..64c97c025 --- /dev/null +++ b/artiq/firmware/libdyld/Cargo.toml @@ -0,0 +1,8 @@ +[package] +authors = ["M-Labs"] +name = "dyld" +version = "0.0.0" + +[lib] +name = "dyld" +path = "lib.rs" diff --git a/artiq/firmware/libdyld/elf.rs b/artiq/firmware/libdyld/elf.rs new file mode 100644 index 000000000..0385bc768 --- /dev/null +++ b/artiq/firmware/libdyld/elf.rs @@ -0,0 +1,2737 @@ +/* generated from elf.h with rust-bindgen and then manually altered */ +#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)] + +pub const EI_NIDENT: usize = 16; +pub const EI_MAG0: usize = 0; +pub const ELFMAG0: u8 = 127; +pub const EI_MAG1: usize = 1; +pub const ELFMAG1: u8 = b'E'; +pub const EI_MAG2: usize = 2; +pub const ELFMAG2: u8 = b'L'; +pub const EI_MAG3: usize = 3; +pub const ELFMAG3: u8 = b'F'; +pub const ELFMAG: &'static [u8; 5usize] = b"\x7fELF\x00"; +pub const SELFMAG: usize = 4; +pub const EI_CLASS: usize = 4; +pub const ELFCLASSNONE: u8 = 0; +pub const ELFCLASS32: u8 = 1; +pub const ELFCLASS64: u8 = 2; +pub const ELFCLASSNUM: u8 = 3; +pub const EI_DATA: usize = 5; +pub const ELFDATANONE: u8 = 0; +pub const ELFDATA2LSB: u8 = 1; +pub const ELFDATA2MSB: u8 = 2; +pub const ELFDATANUM: u8 = 3; +pub const EI_VERSION: usize = 6; +pub const EI_OSABI: usize = 7; +pub const ELFOSABI_NONE: u8 = 0; +pub const ELFOSABI_SYSV: u8 = 0; +pub const ELFOSABI_HPUX: u8 = 1; +pub const ELFOSABI_NETBSD: u8 = 2; +pub const ELFOSABI_GNU: u8 = 3; +pub const ELFOSABI_LINUX: u8 = 3; +pub const ELFOSABI_SOLARIS: u8 = 6; +pub const ELFOSABI_AIX: u8 = 7; +pub const ELFOSABI_IRIX: u8 = 8; +pub const ELFOSABI_FREEBSD: u8 = 9; +pub const ELFOSABI_TRU64: u8 = 10; +pub const ELFOSABI_MODESTO: u8 = 11; +pub const ELFOSABI_OPENBSD: u8 = 12; +pub const ELFOSABI_ARM_AEABI: u8 = 64; +pub const ELFOSABI_ARM: u8 = 97; +pub const ELFOSABI_STANDALONE: u8 = 255; +pub const EI_ABIVERSION: usize = 8; +pub const EI_PAD: usize = 9; +pub const ET_NONE: u16 = 0; +pub const ET_REL: u16 = 1; +pub const ET_EXEC: u16 = 2; +pub const ET_DYN: u16 = 3; +pub const ET_CORE: u16 = 4; +pub const ET_NUM: u16 = 5; +pub const ET_LOOS: u16 = 65024; +pub const ET_HIOS: u16 = 65279; +pub const ET_LOPROC: u16 = 65280; +pub const ET_HIPROC: u16 = 65535; +pub const EM_NONE: u16 = 0; +pub const EM_M32: u16 = 1; +pub const EM_SPARC: u16 = 2; +pub const EM_386: u16 = 3; +pub const EM_68K: u16 = 4; +pub const EM_88K: u16 = 5; +pub const EM_860: u16 = 7; +pub const EM_MIPS: u16 = 8; +pub const EM_S370: u16 = 9; +pub const EM_MIPS_RS3_LE: u16 = 10; +pub const EM_PARISC: u16 = 15; +pub const EM_VPP500: u16 = 17; +pub const EM_SPARC32PLUS: u16 = 18; +pub const EM_960: u16 = 19; +pub const EM_PPC: u16 = 20; +pub const EM_PPC64: u16 = 21; +pub const EM_S390: u16 = 22; +pub const EM_V800: u16 = 36; +pub const EM_FR20: u16 = 37; +pub const EM_RH32: u16 = 38; +pub const EM_RCE: u16 = 39; +pub const EM_ARM: u16 = 40; +pub const EM_FAKE_ALPHA: u16 = 41; +pub const EM_SH: u16 = 42; +pub const EM_SPARCV9: u16 = 43; +pub const EM_TRICORE: u16 = 44; +pub const EM_ARC: u16 = 45; +pub const EM_H8_300: u16 = 46; +pub const EM_H8_300H: u16 = 47; +pub const EM_H8S: u16 = 48; +pub const EM_H8_500: u16 = 49; +pub const EM_IA_64: u16 = 50; +pub const EM_MIPS_X: u16 = 51; +pub const EM_COLDFIRE: u16 = 52; +pub const EM_68HC12: u16 = 53; +pub const EM_MMA: u16 = 54; +pub const EM_PCP: u16 = 55; +pub const EM_NCPU: u16 = 56; +pub const EM_NDR1: u16 = 57; +pub const EM_STARCORE: u16 = 58; +pub const EM_ME16: u16 = 59; +pub const EM_ST100: u16 = 60; +pub const EM_TINYJ: u16 = 61; +pub const EM_X86_64: u16 = 62; +pub const EM_PDSP: u16 = 63; +pub const EM_FX66: u16 = 66; +pub const EM_ST9PLUS: u16 = 67; +pub const EM_ST7: u16 = 68; +pub const EM_68HC16: u16 = 69; +pub const EM_68HC11: u16 = 70; +pub const EM_68HC08: u16 = 71; +pub const EM_68HC05: u16 = 72; +pub const EM_SVX: u16 = 73; +pub const EM_ST19: u16 = 74; +pub const EM_VAX: u16 = 75; +pub const EM_CRIS: u16 = 76; +pub const EM_JAVELIN: u16 = 77; +pub const EM_FIREPATH: u16 = 78; +pub const EM_ZSP: u16 = 79; +pub const EM_MMIX: u16 = 80; +pub const EM_HUANY: u16 = 81; +pub const EM_PRISM: u16 = 82; +pub const EM_AVR: u16 = 83; +pub const EM_FR30: u16 = 84; +pub const EM_D10V: u16 = 85; +pub const EM_D30V: u16 = 86; +pub const EM_V850: u16 = 87; +pub const EM_M32R: u16 = 88; +pub const EM_MN10300: u16 = 89; +pub const EM_MN10200: u16 = 90; +pub const EM_PJ: u16 = 91; +pub const EM_OPENRISC: u16 = 92; +pub const EM_ARC_A5: u16 = 93; +pub const EM_XTENSA: u16 = 94; +pub const EM_AARCH64: u16 = 183; +pub const EM_TILEPRO: u16 = 188; +pub const EM_MICROBLAZE: u16 = 189; +pub const EM_TILEGX: u16 = 191; +pub const EM_NUM: u16 = 192; +pub const EM_ALPHA: u16 = 36902; +pub const EV_NONE: u8 = 0; +pub const EV_CURRENT: u8 = 1; +pub const EV_NUM: u8 = 2; +pub const SHN_UNDEF: u16 = 0; +pub const SHN_LORESERVE: u16 = 65280; +pub const SHN_LOPROC: u16 = 65280; +pub const SHN_BEFORE: u16 = 65280; +pub const SHN_AFTER: u16 = 65281; +pub const SHN_HIPROC: u16 = 65311; +pub const SHN_LOOS: u16 = 65312; +pub const SHN_HIOS: u16 = 65343; +pub const SHN_ABS: u16 = 65521; +pub const SHN_COMMON: u16 = 65522; +pub const SHN_XINDEX: u16 = 65535; +pub const SHN_HIRESERVE: u16 = 65535; +pub const SHT_NULL: usize = 0; +pub const SHT_PROGBITS: usize = 1; +pub const SHT_SYMTAB: usize = 2; +pub const SHT_STRTAB: usize = 3; +pub const SHT_RELA: usize = 4; +pub const SHT_HASH: usize = 5; +pub const SHT_DYNAMIC: usize = 6; +pub const SHT_NOTE: usize = 7; +pub const SHT_NOBITS: usize = 8; +pub const SHT_REL: usize = 9; +pub const SHT_SHLIB: usize = 10; +pub const SHT_DYNSYM: usize = 11; +pub const SHT_INIT_ARRAY: usize = 14; +pub const SHT_FINI_ARRAY: usize = 15; +pub const SHT_PREINIT_ARRAY: usize = 16; +pub const SHT_GROUP: usize = 17; +pub const SHT_SYMTAB_SHNDX: usize = 18; +pub const SHT_NUM: usize = 19; +pub const SHT_LOOS: usize = 1610612736; +pub const SHT_GNU_ATTRIBUTES: usize = 1879048181; +pub const SHT_GNU_HASH: usize = 1879048182; +pub const SHT_GNU_LIBLIST: usize = 1879048183; +pub const SHT_CHECKSUM: usize = 1879048184; +pub const SHT_LOSUNW: usize = 1879048186; +pub const SHT_SUNW_move: usize = 1879048186; +pub const SHT_SUNW_COMDAT: usize = 1879048187; +pub const SHT_SUNW_syminfo: usize = 1879048188; +pub const SHT_GNU_verdef: usize = 1879048189; +pub const SHT_GNU_verneed: usize = 1879048190; +pub const SHT_GNU_versym: usize = 1879048191; +pub const SHT_HISUNW: usize = 1879048191; +pub const SHT_HIOS: usize = 1879048191; +pub const SHT_LOPROC: usize = 1879048192; +pub const SHT_HIPROC: usize = 2147483647; +pub const SHT_LOUSER: usize = 2147483648; +pub const SHT_HIUSER: usize = 2415919103; +pub const SHF_WRITE: usize = 1; +pub const SHF_ALLOC: usize = 2; +pub const SHF_EXECINSTR: usize = 4; +pub const SHF_MERGE: usize = 16; +pub const SHF_STRINGS: usize = 32; +pub const SHF_INFO_LINK: usize = 64; +pub const SHF_LINK_ORDER: usize = 128; +pub const SHF_OS_NONCONFORMING: usize = 256; +pub const SHF_GROUP: usize = 512; +pub const SHF_TLS: usize = 1024; +pub const SHF_MASKOS: usize = 267386880; +pub const SHF_MASKPROC: usize = 4026531840; +pub const SHF_ORDERED: usize = 1073741824; +pub const SHF_EXCLUDE: usize = 2147483648; +pub const GRP_COMDAT: usize = 1; +pub const SYMINFO_BT_SELF: usize = 65535; +pub const SYMINFO_BT_PARENT: usize = 65534; +pub const SYMINFO_BT_LOWRESERVE: usize = 65280; +pub const SYMINFO_FLG_DIRECT: usize = 1; +pub const SYMINFO_FLG_PASSTHRU: usize = 2; +pub const SYMINFO_FLG_COPY: usize = 4; +pub const SYMINFO_FLG_LAZYLOAD: usize = 8; +pub const SYMINFO_NONE: usize = 0; +pub const SYMINFO_CURRENT: usize = 1; +pub const SYMINFO_NUM: usize = 2; +pub const STB_LOCAL: u8 = 0; +pub const STB_GLOBAL: u8 = 1; +pub const STB_WEAK: u8 = 2; +pub const STB_NUM: u8 = 3; +pub const STB_LOOS: u8 = 10; +pub const STB_GNU_UNIQUE: u8 = 10; +pub const STB_HIOS: u8 = 12; +pub const STB_LOPROC: u8 = 13; +pub const STB_HIPROC: u8 = 15; +pub const STT_NOTYPE: u8 = 0; +pub const STT_OBJECT: u8 = 1; +pub const STT_FUNC: u8 = 2; +pub const STT_SECTION: u8 = 3; +pub const STT_FILE: u8 = 4; +pub const STT_COMMON: u8 = 5; +pub const STT_TLS: u8 = 6; +pub const STT_NUM: u8 = 7; +pub const STT_LOOS: u8 = 10; +pub const STT_GNU_IFUNC: u8 = 10; +pub const STT_HIOS: u8 = 12; +pub const STT_LOPROC: u8 = 13; +pub const STT_HIPROC: u8 = 15; +pub const STN_UNDEF: usize = 0; +pub const STV_DEFAULT: usize = 0; +pub const STV_INTERNAL: usize = 1; +pub const STV_HIDDEN: usize = 2; +pub const STV_PROTECTED: usize = 3; +pub const PN_XNUM: usize = 65535; +pub const PT_NULL: u32 = 0; +pub const PT_LOAD: u32 = 1; +pub const PT_DYNAMIC: u32 = 2; +pub const PT_INTERP: u32 = 3; +pub const PT_NOTE: u32 = 4; +pub const PT_SHLIB: u32 = 5; +pub const PT_PHDR: u32 = 6; +pub const PT_TLS: u32 = 7; +pub const PT_NUM: u32 = 8; +pub const PT_LOOS: u32 = 1610612736; +pub const PT_GNU_EH_FRAME: u32 = 1685382480; +pub const PT_GNU_STACK: u32 = 1685382481; +pub const PT_GNU_RELRO: u32 = 1685382482; +pub const PT_LOSUNW: u32 = 1879048186; +pub const PT_SUNWBSS: u32 = 1879048186; +pub const PT_SUNWSTACK: u32 = 1879048187; +pub const PT_HISUNW: u32 = 1879048191; +pub const PT_HIOS: u32 = 1879048191; +pub const PT_LOPROC: u32 = 1879048192; +pub const PT_HIPROC: u32 = 2147483647; +pub const PF_X: usize = 1; +pub const PF_W: usize = 2; +pub const PF_R: usize = 4; +pub const PF_MASKOS: usize = 267386880; +pub const PF_MASKPROC: usize = 4026531840; +pub const NT_PRSTATUS: usize = 1; +pub const NT_FPREGSET: usize = 2; +pub const NT_PRPSINFO: usize = 3; +pub const NT_PRXREG: usize = 4; +pub const NT_TASKSTRUCT: usize = 4; +pub const NT_PLATFORM: usize = 5; +pub const NT_AUXV: usize = 6; +pub const NT_GWINDOWS: usize = 7; +pub const NT_ASRS: usize = 8; +pub const NT_PSTATUS: usize = 10; +pub const NT_PSINFO: usize = 13; +pub const NT_PRCRED: usize = 14; +pub const NT_UTSNAME: usize = 15; +pub const NT_LWPSTATUS: usize = 16; +pub const NT_LWPSINFO: usize = 17; +pub const NT_PRFPXREG: usize = 20; +pub const NT_SIGINFO: usize = 1397311305; +pub const NT_FILE: usize = 1179208773; +pub const NT_PRXFPREG: usize = 1189489535; +pub const NT_PPC_VMX: usize = 256; +pub const NT_PPC_SPE: usize = 257; +pub const NT_PPC_VSX: usize = 258; +pub const NT_386_TLS: usize = 512; +pub const NT_386_IOPERM: usize = 513; +pub const NT_X86_XSTATE: usize = 514; +pub const NT_S390_HIGH_GPRS: usize = 768; +pub const NT_S390_TIMER: usize = 769; +pub const NT_S390_TODCMP: usize = 770; +pub const NT_S390_TODPREG: usize = 771; +pub const NT_S390_CTRS: usize = 772; +pub const NT_S390_PREFIX: usize = 773; +pub const NT_S390_LAST_BREAK: usize = 774; +pub const NT_S390_SYSTEM_CALL: usize = 775; +pub const NT_S390_TDB: usize = 776; +pub const NT_ARM_VFP: usize = 1024; +pub const NT_ARM_TLS: usize = 1025; +pub const NT_ARM_HW_BREAK: usize = 1026; +pub const NT_ARM_HW_WATCH: usize = 1027; +pub const NT_VERSION: usize = 1; +pub const DT_NULL: i32 = 0; +pub const DT_NEEDED: i32 = 1; +pub const DT_PLTRELSZ: i32 = 2; +pub const DT_PLTGOT: i32 = 3; +pub const DT_HASH: i32 = 4; +pub const DT_STRTAB: i32 = 5; +pub const DT_SYMTAB: i32 = 6; +pub const DT_RELA: i32 = 7; +pub const DT_RELASZ: i32 = 8; +pub const DT_RELAENT: i32 = 9; +pub const DT_STRSZ: i32 = 10; +pub const DT_SYMENT: i32 = 11; +pub const DT_INIT: i32 = 12; +pub const DT_FINI: i32 = 13; +pub const DT_SONAME: i32 = 14; +pub const DT_RPATH: i32 = 15; +pub const DT_SYMBOLIC: i32 = 16; +pub const DT_REL: i32 = 17; +pub const DT_RELSZ: i32 = 18; +pub const DT_RELENT: i32 = 19; +pub const DT_PLTREL: i32 = 20; +pub const DT_DEBUG: i32 = 21; +pub const DT_TEXTREL: i32 = 22; +pub const DT_JMPREL: i32 = 23; +pub const DT_BIND_NOW: i32 = 24; +pub const DT_INIT_ARRAY: i32 = 25; +pub const DT_FINI_ARRAY: i32 = 26; +pub const DT_INIT_ARRAYSZ: i32 = 27; +pub const DT_FINI_ARRAYSZ: i32 = 28; +pub const DT_RUNPATH: i32 = 29; +pub const DT_FLAGS: i32 = 30; +pub const DT_ENCODING: i32 = 32; +pub const DT_PREINIT_ARRAY: i32 = 32; +pub const DT_PREINIT_ARRAYSZ: i32 = 33; +pub const DT_NUM: i32 = 34; +pub const DT_LOOS: i32 = 1610612749; +pub const DT_HIOS: i32 = 1879044096; +pub const DT_LOPROC: i32 = 1879048192; +pub const DT_HIPROC: i32 = 2147483647; +pub const DT_VALRNGLO: i32 = 1879047424; +pub const DT_GNU_PRELINKED: i32 = 1879047669; +pub const DT_GNU_CONFLICTSZ: i32 = 1879047670; +pub const DT_GNU_LIBLISTSZ: i32 = 1879047671; +pub const DT_CHECKSUM: i32 = 1879047672; +pub const DT_PLTPADSZ: i32 = 1879047673; +pub const DT_MOVEENT: i32 = 1879047674; +pub const DT_MOVESZ: i32 = 1879047675; +pub const DT_FEATURE_1: i32 = 1879047676; +pub const DT_POSFLAG_1: i32 = 1879047677; +pub const DT_SYMINSZ: i32 = 1879047678; +pub const DT_SYMINENT: i32 = 1879047679; +pub const DT_VALRNGHI: i32 = 1879047679; +pub const DT_VALNUM: i32 = 12; +pub const DT_ADDRRNGLO: i32 = 1879047680; +pub const DT_GNU_HASH: i32 = 1879047925; +pub const DT_TLSDESC_PLT: i32 = 1879047926; +pub const DT_TLSDESC_GOT: i32 = 1879047927; +pub const DT_GNU_CONFLICT: i32 = 1879047928; +pub const DT_GNU_LIBLIST: i32 = 1879047929; +pub const DT_CONFIG: i32 = 1879047930; +pub const DT_DEPAUDIT: i32 = 1879047931; +pub const DT_AUDIT: i32 = 1879047932; +pub const DT_PLTPAD: i32 = 1879047933; +pub const DT_MOVETAB: i32 = 1879047934; +pub const DT_SYMINFO: i32 = 1879047935; +pub const DT_ADDRRNGHI: i32 = 1879047935; +pub const DT_ADDRNUM: i32 = 11; +pub const DT_VERSYM: i32 = 1879048176; +pub const DT_RELACOUNT: i32 = 1879048185; +pub const DT_RELCOUNT: i32 = 1879048186; +pub const DT_FLAGS_1: i32 = 1879048187; +pub const DT_VERDEF: i32 = 1879048188; +pub const DT_VERDEFNUM: i32 = 1879048189; +pub const DT_VERNEED: i32 = 1879048190; +pub const DT_VERNEEDNUM: i32 = 1879048191; +pub const DT_VERSIONTAGNUM: i32 = 16; +pub const DT_AUXILIARY: i32 = 2147483645; +pub const DT_FILTER: i32 = 2147483647; +pub const DT_EXTRANUM: i32 = 3; +pub const DF_ORIGIN: usize = 1; +pub const DF_SYMBOLIC: usize = 2; +pub const DF_TEXTREL: usize = 4; +pub const DF_BIND_NOW: usize = 8; +pub const DF_STATIC_TLS: usize = 16; +pub const DF_1_NOW: usize = 1; +pub const DF_1_GLOBAL: usize = 2; +pub const DF_1_GROUP: usize = 4; +pub const DF_1_NODELETE: usize = 8; +pub const DF_1_LOADFLTR: usize = 16; +pub const DF_1_INITFIRST: usize = 32; +pub const DF_1_NOOPEN: usize = 64; +pub const DF_1_ORIGIN: usize = 128; +pub const DF_1_DIRECT: usize = 256; +pub const DF_1_TRANS: usize = 512; +pub const DF_1_INTERPOSE: usize = 1024; +pub const DF_1_NODEFLIB: usize = 2048; +pub const DF_1_NODUMP: usize = 4096; +pub const DF_1_CONFALT: usize = 8192; +pub const DF_1_ENDFILTEE: usize = 16384; +pub const DF_1_DISPRELDNE: usize = 32768; +pub const DF_1_DISPRELPND: usize = 65536; +pub const DF_1_NODIRECT: usize = 131072; +pub const DF_1_IGNMULDEF: usize = 262144; +pub const DF_1_NOKSYMS: usize = 524288; +pub const DF_1_NOHDR: usize = 1048576; +pub const DF_1_EDITED: usize = 2097152; +pub const DF_1_NORELOC: usize = 4194304; +pub const DF_1_SYMINTPOSE: usize = 8388608; +pub const DF_1_GLOBAUDIT: usize = 16777216; +pub const DF_1_SINGLETON: usize = 33554432; +pub const DTF_1_PARINIT: usize = 1; +pub const DTF_1_CONFEXP: usize = 2; +pub const DF_P1_LAZYLOAD: usize = 1; +pub const DF_P1_GROUPPERM: usize = 2; +pub const VER_DEF_NONE: usize = 0; +pub const VER_DEF_CURRENT: usize = 1; +pub const VER_DEF_NUM: usize = 2; +pub const VER_FLG_BASE: usize = 1; +pub const VER_FLG_WEAK: usize = 2; +pub const VER_NDX_LOCAL: usize = 0; +pub const VER_NDX_GLOBAL: usize = 1; +pub const VER_NDX_LORESERVE: usize = 65280; +pub const VER_NDX_ELIMINATE: usize = 65281; +pub const VER_NEED_NONE: usize = 0; +pub const VER_NEED_CURRENT: usize = 1; +pub const VER_NEED_NUM: usize = 2; +pub const ELF_NOTE_SOLARIS: &'static [u8; 13usize] = b"SUNW Solaris\x00"; +pub const ELF_NOTE_GNU: &'static [u8; 4usize] = b"GNU\x00"; +pub const ELF_NOTE_PAGESIZE_HINT: usize = 1; +pub const NT_GNU_ABI_TAG: usize = 1; +pub const ELF_NOTE_ABI: usize = 1; +pub const ELF_NOTE_OS_LINUX: usize = 0; +pub const ELF_NOTE_OS_GNU: usize = 1; +pub const ELF_NOTE_OS_SOLARIS2: usize = 2; +pub const ELF_NOTE_OS_FREEBSD: usize = 3; +pub const NT_GNU_HWCAP: usize = 2; +pub const NT_GNU_BUILD_ID: usize = 3; +pub const NT_GNU_GOLD_VERSION: usize = 4; +pub const EF_CPU32: usize = 8454144; +pub const R_68K_NONE: usize = 0; +pub const R_68K_32: usize = 1; +pub const R_68K_16: usize = 2; +pub const R_68K_8: usize = 3; +pub const R_68K_PC32: usize = 4; +pub const R_68K_PC16: usize = 5; +pub const R_68K_PC8: usize = 6; +pub const R_68K_GOT32: usize = 7; +pub const R_68K_GOT16: usize = 8; +pub const R_68K_GOT8: usize = 9; +pub const R_68K_GOT32O: usize = 10; +pub const R_68K_GOT16O: usize = 11; +pub const R_68K_GOT8O: usize = 12; +pub const R_68K_PLT32: usize = 13; +pub const R_68K_PLT16: usize = 14; +pub const R_68K_PLT8: usize = 15; +pub const R_68K_PLT32O: usize = 16; +pub const R_68K_PLT16O: usize = 17; +pub const R_68K_PLT8O: usize = 18; +pub const R_68K_COPY: usize = 19; +pub const R_68K_GLOB_DAT: usize = 20; +pub const R_68K_JMP_SLOT: usize = 21; +pub const R_68K_RELATIVE: usize = 22; +pub const R_68K_TLS_GD32: usize = 25; +pub const R_68K_TLS_GD16: usize = 26; +pub const R_68K_TLS_GD8: usize = 27; +pub const R_68K_TLS_LDM32: usize = 28; +pub const R_68K_TLS_LDM16: usize = 29; +pub const R_68K_TLS_LDM8: usize = 30; +pub const R_68K_TLS_LDO32: usize = 31; +pub const R_68K_TLS_LDO16: usize = 32; +pub const R_68K_TLS_LDO8: usize = 33; +pub const R_68K_TLS_IE32: usize = 34; +pub const R_68K_TLS_IE16: usize = 35; +pub const R_68K_TLS_IE8: usize = 36; +pub const R_68K_TLS_LE32: usize = 37; +pub const R_68K_TLS_LE16: usize = 38; +pub const R_68K_TLS_LE8: usize = 39; +pub const R_68K_TLS_DTPMOD32: usize = 40; +pub const R_68K_TLS_DTPREL32: usize = 41; +pub const R_68K_TLS_TPREL32: usize = 42; +pub const R_68K_NUM: usize = 43; +pub const R_386_NONE: usize = 0; +pub const R_386_32: usize = 1; +pub const R_386_PC32: usize = 2; +pub const R_386_GOT32: usize = 3; +pub const R_386_PLT32: usize = 4; +pub const R_386_COPY: usize = 5; +pub const R_386_GLOB_DAT: usize = 6; +pub const R_386_JMP_SLOT: usize = 7; +pub const R_386_RELATIVE: usize = 8; +pub const R_386_GOTOFF: usize = 9; +pub const R_386_GOTPC: usize = 10; +pub const R_386_32PLT: usize = 11; +pub const R_386_TLS_TPOFF: usize = 14; +pub const R_386_TLS_IE: usize = 15; +pub const R_386_TLS_GOTIE: usize = 16; +pub const R_386_TLS_LE: usize = 17; +pub const R_386_TLS_GD: usize = 18; +pub const R_386_TLS_LDM: usize = 19; +pub const R_386_16: usize = 20; +pub const R_386_PC16: usize = 21; +pub const R_386_8: usize = 22; +pub const R_386_PC8: usize = 23; +pub const R_386_TLS_GD_32: usize = 24; +pub const R_386_TLS_GD_PUSH: usize = 25; +pub const R_386_TLS_GD_CALL: usize = 26; +pub const R_386_TLS_GD_POP: usize = 27; +pub const R_386_TLS_LDM_32: usize = 28; +pub const R_386_TLS_LDM_PUSH: usize = 29; +pub const R_386_TLS_LDM_CALL: usize = 30; +pub const R_386_TLS_LDM_POP: usize = 31; +pub const R_386_TLS_LDO_32: usize = 32; +pub const R_386_TLS_IE_32: usize = 33; +pub const R_386_TLS_LE_32: usize = 34; +pub const R_386_TLS_DTPMOD32: usize = 35; +pub const R_386_TLS_DTPOFF32: usize = 36; +pub const R_386_TLS_TPOFF32: usize = 37; +pub const R_386_SIZE32: usize = 38; +pub const R_386_TLS_GOTDESC: usize = 39; +pub const R_386_TLS_DESC_CALL: usize = 40; +pub const R_386_TLS_DESC: usize = 41; +pub const R_386_IRELATIVE: usize = 42; +pub const R_386_NUM: usize = 43; +pub const STT_SPARC_REGISTER: usize = 13; +pub const EF_SPARCV9_MM: usize = 3; +pub const EF_SPARCV9_TSO: usize = 0; +pub const EF_SPARCV9_PSO: usize = 1; +pub const EF_SPARCV9_RMO: usize = 2; +pub const EF_SPARC_LEDATA: usize = 8388608; +pub const EF_SPARC_EXT_MASK: usize = 16776960; +pub const EF_SPARC_32PLUS: usize = 256; +pub const EF_SPARC_SUN_US1: usize = 512; +pub const EF_SPARC_HAL_R1: usize = 1024; +pub const EF_SPARC_SUN_US3: usize = 2048; +pub const R_SPARC_NONE: usize = 0; +pub const R_SPARC_8: usize = 1; +pub const R_SPARC_16: usize = 2; +pub const R_SPARC_32: usize = 3; +pub const R_SPARC_DISP8: usize = 4; +pub const R_SPARC_DISP16: usize = 5; +pub const R_SPARC_DISP32: usize = 6; +pub const R_SPARC_WDISP30: usize = 7; +pub const R_SPARC_WDISP22: usize = 8; +pub const R_SPARC_HI22: usize = 9; +pub const R_SPARC_22: usize = 10; +pub const R_SPARC_13: usize = 11; +pub const R_SPARC_LO10: usize = 12; +pub const R_SPARC_GOT10: usize = 13; +pub const R_SPARC_GOT13: usize = 14; +pub const R_SPARC_GOT22: usize = 15; +pub const R_SPARC_PC10: usize = 16; +pub const R_SPARC_PC22: usize = 17; +pub const R_SPARC_WPLT30: usize = 18; +pub const R_SPARC_COPY: usize = 19; +pub const R_SPARC_GLOB_DAT: usize = 20; +pub const R_SPARC_JMP_SLOT: usize = 21; +pub const R_SPARC_RELATIVE: usize = 22; +pub const R_SPARC_UA32: usize = 23; +pub const R_SPARC_PLT32: usize = 24; +pub const R_SPARC_HIPLT22: usize = 25; +pub const R_SPARC_LOPLT10: usize = 26; +pub const R_SPARC_PCPLT32: usize = 27; +pub const R_SPARC_PCPLT22: usize = 28; +pub const R_SPARC_PCPLT10: usize = 29; +pub const R_SPARC_10: usize = 30; +pub const R_SPARC_11: usize = 31; +pub const R_SPARC_64: usize = 32; +pub const R_SPARC_OLO10: usize = 33; +pub const R_SPARC_HH22: usize = 34; +pub const R_SPARC_HM10: usize = 35; +pub const R_SPARC_LM22: usize = 36; +pub const R_SPARC_PC_HH22: usize = 37; +pub const R_SPARC_PC_HM10: usize = 38; +pub const R_SPARC_PC_LM22: usize = 39; +pub const R_SPARC_WDISP16: usize = 40; +pub const R_SPARC_WDISP19: usize = 41; +pub const R_SPARC_GLOB_JMP: usize = 42; +pub const R_SPARC_7: usize = 43; +pub const R_SPARC_5: usize = 44; +pub const R_SPARC_6: usize = 45; +pub const R_SPARC_DISP64: usize = 46; +pub const R_SPARC_PLT64: usize = 47; +pub const R_SPARC_HIX22: usize = 48; +pub const R_SPARC_LOX10: usize = 49; +pub const R_SPARC_H44: usize = 50; +pub const R_SPARC_M44: usize = 51; +pub const R_SPARC_L44: usize = 52; +pub const R_SPARC_REGISTER: usize = 53; +pub const R_SPARC_UA64: usize = 54; +pub const R_SPARC_UA16: usize = 55; +pub const R_SPARC_TLS_GD_HI22: usize = 56; +pub const R_SPARC_TLS_GD_LO10: usize = 57; +pub const R_SPARC_TLS_GD_ADD: usize = 58; +pub const R_SPARC_TLS_GD_CALL: usize = 59; +pub const R_SPARC_TLS_LDM_HI22: usize = 60; +pub const R_SPARC_TLS_LDM_LO10: usize = 61; +pub const R_SPARC_TLS_LDM_ADD: usize = 62; +pub const R_SPARC_TLS_LDM_CALL: usize = 63; +pub const R_SPARC_TLS_LDO_HIX22: usize = 64; +pub const R_SPARC_TLS_LDO_LOX10: usize = 65; +pub const R_SPARC_TLS_LDO_ADD: usize = 66; +pub const R_SPARC_TLS_IE_HI22: usize = 67; +pub const R_SPARC_TLS_IE_LO10: usize = 68; +pub const R_SPARC_TLS_IE_LD: usize = 69; +pub const R_SPARC_TLS_IE_LDX: usize = 70; +pub const R_SPARC_TLS_IE_ADD: usize = 71; +pub const R_SPARC_TLS_LE_HIX22: usize = 72; +pub const R_SPARC_TLS_LE_LOX10: usize = 73; +pub const R_SPARC_TLS_DTPMOD32: usize = 74; +pub const R_SPARC_TLS_DTPMOD64: usize = 75; +pub const R_SPARC_TLS_DTPOFF32: usize = 76; +pub const R_SPARC_TLS_DTPOFF64: usize = 77; +pub const R_SPARC_TLS_TPOFF32: usize = 78; +pub const R_SPARC_TLS_TPOFF64: usize = 79; +pub const R_SPARC_GOTDATA_HIX22: usize = 80; +pub const R_SPARC_GOTDATA_LOX10: usize = 81; +pub const R_SPARC_GOTDATA_OP_HIX22: usize = 82; +pub const R_SPARC_GOTDATA_OP_LOX10: usize = 83; +pub const R_SPARC_GOTDATA_OP: usize = 84; +pub const R_SPARC_H34: usize = 85; +pub const R_SPARC_SIZE32: usize = 86; +pub const R_SPARC_SIZE64: usize = 87; +pub const R_SPARC_WDISP10: usize = 88; +pub const R_SPARC_JMP_IREL: usize = 248; +pub const R_SPARC_IRELATIVE: usize = 249; +pub const R_SPARC_GNU_VTINHERIT: usize = 250; +pub const R_SPARC_GNU_VTENTRY: usize = 251; +pub const R_SPARC_REV32: usize = 252; +pub const R_SPARC_NUM: usize = 253; +pub const DT_SPARC_REGISTER: usize = 1879048193; +pub const DT_SPARC_NUM: usize = 2; +pub const EF_MIPS_NOREORDER: usize = 1; +pub const EF_MIPS_PIC: usize = 2; +pub const EF_MIPS_CPIC: usize = 4; +pub const EF_MIPS_XGOT: usize = 8; +pub const EF_MIPS_64BIT_WHIRL: usize = 16; +pub const EF_MIPS_ABI2: usize = 32; +pub const EF_MIPS_ABI_ON32: usize = 64; +pub const EF_MIPS_NAN2008: usize = 1024; +pub const EF_MIPS_ARCH: usize = 4026531840; +pub const EF_MIPS_ARCH_1: usize = 0; +pub const EF_MIPS_ARCH_2: usize = 268435456; +pub const EF_MIPS_ARCH_3: usize = 536870912; +pub const EF_MIPS_ARCH_4: usize = 805306368; +pub const EF_MIPS_ARCH_5: usize = 1073741824; +pub const EF_MIPS_ARCH_32: usize = 1342177280; +pub const EF_MIPS_ARCH_64: usize = 1610612736; +pub const EF_MIPS_ARCH_32R2: usize = 1879048192; +pub const EF_MIPS_ARCH_64R2: usize = 2147483648; +pub const E_MIPS_ARCH_1: usize = 0; +pub const E_MIPS_ARCH_2: usize = 268435456; +pub const E_MIPS_ARCH_3: usize = 536870912; +pub const E_MIPS_ARCH_4: usize = 805306368; +pub const E_MIPS_ARCH_5: usize = 1073741824; +pub const E_MIPS_ARCH_32: usize = 1342177280; +pub const E_MIPS_ARCH_64: usize = 1610612736; +pub const SHN_MIPS_ACOMMON: usize = 65280; +pub const SHN_MIPS_TEXT: usize = 65281; +pub const SHN_MIPS_DATA: usize = 65282; +pub const SHN_MIPS_SCOMMON: usize = 65283; +pub const SHN_MIPS_SUNDEFINED: usize = 65284; +pub const SHT_MIPS_LIBLIST: usize = 1879048192; +pub const SHT_MIPS_MSYM: usize = 1879048193; +pub const SHT_MIPS_CONFLICT: usize = 1879048194; +pub const SHT_MIPS_GPTAB: usize = 1879048195; +pub const SHT_MIPS_UCODE: usize = 1879048196; +pub const SHT_MIPS_DEBUG: usize = 1879048197; +pub const SHT_MIPS_REGINFO: usize = 1879048198; +pub const SHT_MIPS_PACKAGE: usize = 1879048199; +pub const SHT_MIPS_PACKSYM: usize = 1879048200; +pub const SHT_MIPS_RELD: usize = 1879048201; +pub const SHT_MIPS_IFACE: usize = 1879048203; +pub const SHT_MIPS_CONTENT: usize = 1879048204; +pub const SHT_MIPS_OPTIONS: usize = 1879048205; +pub const SHT_MIPS_SHDR: usize = 1879048208; +pub const SHT_MIPS_FDESC: usize = 1879048209; +pub const SHT_MIPS_EXTSYM: usize = 1879048210; +pub const SHT_MIPS_DENSE: usize = 1879048211; +pub const SHT_MIPS_PDESC: usize = 1879048212; +pub const SHT_MIPS_LOCSYM: usize = 1879048213; +pub const SHT_MIPS_AUXSYM: usize = 1879048214; +pub const SHT_MIPS_OPTSYM: usize = 1879048215; +pub const SHT_MIPS_LOCSTR: usize = 1879048216; +pub const SHT_MIPS_LINE: usize = 1879048217; +pub const SHT_MIPS_RFDESC: usize = 1879048218; +pub const SHT_MIPS_DELTASYM: usize = 1879048219; +pub const SHT_MIPS_DELTAINST: usize = 1879048220; +pub const SHT_MIPS_DELTACLASS: usize = 1879048221; +pub const SHT_MIPS_DWARF: usize = 1879048222; +pub const SHT_MIPS_DELTADECL: usize = 1879048223; +pub const SHT_MIPS_SYMBOL_LIB: usize = 1879048224; +pub const SHT_MIPS_EVENTS: usize = 1879048225; +pub const SHT_MIPS_TRANSLATE: usize = 1879048226; +pub const SHT_MIPS_PIXIE: usize = 1879048227; +pub const SHT_MIPS_XLATE: usize = 1879048228; +pub const SHT_MIPS_XLATE_DEBUG: usize = 1879048229; +pub const SHT_MIPS_WHIRL: usize = 1879048230; +pub const SHT_MIPS_EH_REGION: usize = 1879048231; +pub const SHT_MIPS_XLATE_OLD: usize = 1879048232; +pub const SHT_MIPS_PDR_EXCEPTION: usize = 1879048233; +pub const SHF_MIPS_GPREL: usize = 268435456; +pub const SHF_MIPS_MERGE: usize = 536870912; +pub const SHF_MIPS_ADDR: usize = 1073741824; +pub const SHF_MIPS_STRINGS: usize = 2147483648; +pub const SHF_MIPS_NOSTRIP: usize = 134217728; +pub const SHF_MIPS_LOCAL: usize = 67108864; +pub const SHF_MIPS_NAMES: usize = 33554432; +pub const SHF_MIPS_NODUPE: usize = 16777216; +pub const STO_MIPS_DEFAULT: usize = 0; +pub const STO_MIPS_INTERNAL: usize = 1; +pub const STO_MIPS_HIDDEN: usize = 2; +pub const STO_MIPS_PROTECTED: usize = 3; +pub const STO_MIPS_PLT: usize = 8; +pub const STO_MIPS_SC_ALIGN_UNUSED: usize = 255; +pub const STB_MIPS_SPLIT_COMMON: usize = 13; +pub const ODK_NULL: usize = 0; +pub const ODK_REGINFO: usize = 1; +pub const ODK_EXCEPTIONS: usize = 2; +pub const ODK_PAD: usize = 3; +pub const ODK_HWPATCH: usize = 4; +pub const ODK_FILL: usize = 5; +pub const ODK_TAGS: usize = 6; +pub const ODK_HWAND: usize = 7; +pub const ODK_HWOR: usize = 8; +pub const OEX_FPU_MIN: usize = 31; +pub const OEX_FPU_MAX: usize = 7936; +pub const OEX_PAGE0: usize = 65536; +pub const OEX_SMM: usize = 131072; +pub const OEX_FPDBUG: usize = 262144; +pub const OEX_PRECISEFP: usize = 262144; +pub const OEX_DISMISS: usize = 524288; +pub const OEX_FPU_INVAL: usize = 16; +pub const OEX_FPU_DIV0: usize = 8; +pub const OEX_FPU_OFLO: usize = 4; +pub const OEX_FPU_UFLO: usize = 2; +pub const OEX_FPU_INEX: usize = 1; +pub const OHW_R4KEOP: usize = 1; +pub const OHW_R8KPFETCH: usize = 2; +pub const OHW_R5KEOP: usize = 4; +pub const OHW_R5KCVTL: usize = 8; +pub const OPAD_PREFIX: usize = 1; +pub const OPAD_POSTFIX: usize = 2; +pub const OPAD_SYMBOL: usize = 4; +pub const OHWA0_R4KEOP_CHECKED: usize = 1; +pub const OHWA1_R4KEOP_CLEAN: usize = 2; +pub const R_MIPS_NONE: usize = 0; +pub const R_MIPS_16: usize = 1; +pub const R_MIPS_32: usize = 2; +pub const R_MIPS_REL32: usize = 3; +pub const R_MIPS_26: usize = 4; +pub const R_MIPS_HI16: usize = 5; +pub const R_MIPS_LO16: usize = 6; +pub const R_MIPS_GPREL16: usize = 7; +pub const R_MIPS_LITERAL: usize = 8; +pub const R_MIPS_GOT16: usize = 9; +pub const R_MIPS_PC16: usize = 10; +pub const R_MIPS_CALL16: usize = 11; +pub const R_MIPS_GPREL32: usize = 12; +pub const R_MIPS_SHIFT5: usize = 16; +pub const R_MIPS_SHIFT6: usize = 17; +pub const R_MIPS_64: usize = 18; +pub const R_MIPS_GOT_DISP: usize = 19; +pub const R_MIPS_GOT_PAGE: usize = 20; +pub const R_MIPS_GOT_OFST: usize = 21; +pub const R_MIPS_GOT_HI16: usize = 22; +pub const R_MIPS_GOT_LO16: usize = 23; +pub const R_MIPS_SUB: usize = 24; +pub const R_MIPS_INSERT_A: usize = 25; +pub const R_MIPS_INSERT_B: usize = 26; +pub const R_MIPS_DELETE: usize = 27; +pub const R_MIPS_HIGHER: usize = 28; +pub const R_MIPS_HIGHEST: usize = 29; +pub const R_MIPS_CALL_HI16: usize = 30; +pub const R_MIPS_CALL_LO16: usize = 31; +pub const R_MIPS_SCN_DISP: usize = 32; +pub const R_MIPS_REL16: usize = 33; +pub const R_MIPS_ADD_IMMEDIATE: usize = 34; +pub const R_MIPS_PJUMP: usize = 35; +pub const R_MIPS_RELGOT: usize = 36; +pub const R_MIPS_JALR: usize = 37; +pub const R_MIPS_TLS_DTPMOD32: usize = 38; +pub const R_MIPS_TLS_DTPREL32: usize = 39; +pub const R_MIPS_TLS_DTPMOD64: usize = 40; +pub const R_MIPS_TLS_DTPREL64: usize = 41; +pub const R_MIPS_TLS_GD: usize = 42; +pub const R_MIPS_TLS_LDM: usize = 43; +pub const R_MIPS_TLS_DTPREL_HI16: usize = 44; +pub const R_MIPS_TLS_DTPREL_LO16: usize = 45; +pub const R_MIPS_TLS_GOTTPREL: usize = 46; +pub const R_MIPS_TLS_TPREL32: usize = 47; +pub const R_MIPS_TLS_TPREL64: usize = 48; +pub const R_MIPS_TLS_TPREL_HI16: usize = 49; +pub const R_MIPS_TLS_TPREL_LO16: usize = 50; +pub const R_MIPS_GLOB_DAT: usize = 51; +pub const R_MIPS_COPY: usize = 126; +pub const R_MIPS_JUMP_SLOT: usize = 127; +pub const R_MIPS_NUM: usize = 128; +pub const PT_MIPS_REGINFO: usize = 1879048192; +pub const PT_MIPS_RTPROC: usize = 1879048193; +pub const PT_MIPS_OPTIONS: usize = 1879048194; +pub const PF_MIPS_LOCAL: usize = 268435456; +pub const DT_MIPS_RLD_VERSION: usize = 1879048193; +pub const DT_MIPS_TIME_STAMP: usize = 1879048194; +pub const DT_MIPS_ICHECKSUM: usize = 1879048195; +pub const DT_MIPS_IVERSION: usize = 1879048196; +pub const DT_MIPS_FLAGS: usize = 1879048197; +pub const DT_MIPS_BASE_ADDRESS: usize = 1879048198; +pub const DT_MIPS_MSYM: usize = 1879048199; +pub const DT_MIPS_CONFLICT: usize = 1879048200; +pub const DT_MIPS_LIBLIST: usize = 1879048201; +pub const DT_MIPS_LOCAL_GOTNO: usize = 1879048202; +pub const DT_MIPS_CONFLICTNO: usize = 1879048203; +pub const DT_MIPS_LIBLISTNO: usize = 1879048208; +pub const DT_MIPS_SYMTABNO: usize = 1879048209; +pub const DT_MIPS_UNREFEXTNO: usize = 1879048210; +pub const DT_MIPS_GOTSYM: usize = 1879048211; +pub const DT_MIPS_HIPAGENO: usize = 1879048212; +pub const DT_MIPS_RLD_MAP: usize = 1879048214; +pub const DT_MIPS_DELTA_CLASS: usize = 1879048215; +pub const DT_MIPS_DELTA_CLASS_NO: usize = 1879048216; +pub const DT_MIPS_DELTA_INSTANCE: usize = 1879048217; +pub const DT_MIPS_DELTA_INSTANCE_NO: usize = 1879048218; +pub const DT_MIPS_DELTA_RELOC: usize = 1879048219; +pub const DT_MIPS_DELTA_RELOC_NO: usize = 1879048220; +pub const DT_MIPS_DELTA_SYM: usize = 1879048221; +pub const DT_MIPS_DELTA_SYM_NO: usize = 1879048222; +pub const DT_MIPS_DELTA_CLASSSYM: usize = 1879048224; +pub const DT_MIPS_DELTA_CLASSSYM_NO: usize = 1879048225; +pub const DT_MIPS_CXX_FLAGS: usize = 1879048226; +pub const DT_MIPS_PIXIE_INIT: usize = 1879048227; +pub const DT_MIPS_SYMBOL_LIB: usize = 1879048228; +pub const DT_MIPS_LOCALPAGE_GOTIDX: usize = 1879048229; +pub const DT_MIPS_LOCAL_GOTIDX: usize = 1879048230; +pub const DT_MIPS_HIDDEN_GOTIDX: usize = 1879048231; +pub const DT_MIPS_PROTECTED_GOTIDX: usize = 1879048232; +pub const DT_MIPS_OPTIONS: usize = 1879048233; +pub const DT_MIPS_INTERFACE: usize = 1879048234; +pub const DT_MIPS_DYNSTR_ALIGN: usize = 1879048235; +pub const DT_MIPS_INTERFACE_SIZE: usize = 1879048236; +pub const DT_MIPS_RLD_TEXT_RESOLVE_ADDR: usize = 1879048237; +pub const DT_MIPS_PERF_SUFFIX: usize = 1879048238; +pub const DT_MIPS_COMPACT_SIZE: usize = 1879048239; +pub const DT_MIPS_GP_VALUE: usize = 1879048240; +pub const DT_MIPS_AUX_DYNAMIC: usize = 1879048241; +pub const DT_MIPS_PLTGOT: usize = 1879048242; +pub const DT_MIPS_RWPLT: usize = 1879048244; +pub const DT_MIPS_NUM: usize = 53; +pub const RHF_NONE: usize = 0; +pub const RHF_QUICKSTART: usize = 1; +pub const RHF_NOTPOT: usize = 2; +pub const RHF_NO_LIBRARY_REPLACEMENT: usize = 4; +pub const RHF_NO_MOVE: usize = 8; +pub const RHF_SGI_ONLY: usize = 16; +pub const RHF_GUARANTEE_INIT: usize = 32; +pub const RHF_DELTA_C_PLUS_PLUS: usize = 64; +pub const RHF_GUARANTEE_START_INIT: usize = 128; +pub const RHF_PIXIE: usize = 256; +pub const RHF_DEFAULT_DELAY_LOAD: usize = 512; +pub const RHF_REQUICKSTART: usize = 1024; +pub const RHF_REQUICKSTARTED: usize = 2048; +pub const RHF_CORD: usize = 4096; +pub const RHF_NO_UNRES_UNDEF: usize = 8192; +pub const RHF_RLD_ORDER_SAFE: usize = 16384; +pub const LL_NONE: usize = 0; +pub const LL_EXACT_MATCH: usize = 1; +pub const LL_IGNORE_INT_VER: usize = 2; +pub const LL_REQUIRE_MINOR: usize = 4; +pub const LL_EXPORTS: usize = 8; +pub const LL_DELAY_LOAD: usize = 16; +pub const LL_DELTA: usize = 32; +pub const EF_PARISC_TRAPNIL: usize = 65536; +pub const EF_PARISC_EXT: usize = 131072; +pub const EF_PARISC_LSB: usize = 262144; +pub const EF_PARISC_WIDE: usize = 524288; +pub const EF_PARISC_NO_KABP: usize = 1048576; +pub const EF_PARISC_LAZYSWAP: usize = 4194304; +pub const EF_PARISC_ARCH: usize = 65535; +pub const EFA_PARISC_1_0: usize = 523; +pub const EFA_PARISC_1_1: usize = 528; +pub const EFA_PARISC_2_0: usize = 532; +pub const SHN_PARISC_ANSI_COMMON: usize = 65280; +pub const SHN_PARISC_HUGE_COMMON: usize = 65281; +pub const SHT_PARISC_EXT: usize = 1879048192; +pub const SHT_PARISC_UNWIND: usize = 1879048193; +pub const SHT_PARISC_DOC: usize = 1879048194; +pub const SHF_PARISC_SHORT: usize = 536870912; +pub const SHF_PARISC_HUGE: usize = 1073741824; +pub const SHF_PARISC_SBP: usize = 2147483648; +pub const STT_PARISC_MILLICODE: usize = 13; +pub const STT_HP_OPAQUE: usize = 11; +pub const STT_HP_STUB: usize = 12; +pub const R_PARISC_NONE: usize = 0; +pub const R_PARISC_DIR32: usize = 1; +pub const R_PARISC_DIR21L: usize = 2; +pub const R_PARISC_DIR17R: usize = 3; +pub const R_PARISC_DIR17F: usize = 4; +pub const R_PARISC_DIR14R: usize = 6; +pub const R_PARISC_PCREL32: usize = 9; +pub const R_PARISC_PCREL21L: usize = 10; +pub const R_PARISC_PCREL17R: usize = 11; +pub const R_PARISC_PCREL17F: usize = 12; +pub const R_PARISC_PCREL14R: usize = 14; +pub const R_PARISC_DPREL21L: usize = 18; +pub const R_PARISC_DPREL14R: usize = 22; +pub const R_PARISC_GPREL21L: usize = 26; +pub const R_PARISC_GPREL14R: usize = 30; +pub const R_PARISC_LTOFF21L: usize = 34; +pub const R_PARISC_LTOFF14R: usize = 38; +pub const R_PARISC_SECREL32: usize = 41; +pub const R_PARISC_SEGBASE: usize = 48; +pub const R_PARISC_SEGREL32: usize = 49; +pub const R_PARISC_PLTOFF21L: usize = 50; +pub const R_PARISC_PLTOFF14R: usize = 54; +pub const R_PARISC_LTOFF_FPTR32: usize = 57; +pub const R_PARISC_LTOFF_FPTR21L: usize = 58; +pub const R_PARISC_LTOFF_FPTR14R: usize = 62; +pub const R_PARISC_FPTR64: usize = 64; +pub const R_PARISC_PLABEL32: usize = 65; +pub const R_PARISC_PLABEL21L: usize = 66; +pub const R_PARISC_PLABEL14R: usize = 70; +pub const R_PARISC_PCREL64: usize = 72; +pub const R_PARISC_PCREL22F: usize = 74; +pub const R_PARISC_PCREL14WR: usize = 75; +pub const R_PARISC_PCREL14DR: usize = 76; +pub const R_PARISC_PCREL16F: usize = 77; +pub const R_PARISC_PCREL16WF: usize = 78; +pub const R_PARISC_PCREL16DF: usize = 79; +pub const R_PARISC_DIR64: usize = 80; +pub const R_PARISC_DIR14WR: usize = 83; +pub const R_PARISC_DIR14DR: usize = 84; +pub const R_PARISC_DIR16F: usize = 85; +pub const R_PARISC_DIR16WF: usize = 86; +pub const R_PARISC_DIR16DF: usize = 87; +pub const R_PARISC_GPREL64: usize = 88; +pub const R_PARISC_GPREL14WR: usize = 91; +pub const R_PARISC_GPREL14DR: usize = 92; +pub const R_PARISC_GPREL16F: usize = 93; +pub const R_PARISC_GPREL16WF: usize = 94; +pub const R_PARISC_GPREL16DF: usize = 95; +pub const R_PARISC_LTOFF64: usize = 96; +pub const R_PARISC_LTOFF14WR: usize = 99; +pub const R_PARISC_LTOFF14DR: usize = 100; +pub const R_PARISC_LTOFF16F: usize = 101; +pub const R_PARISC_LTOFF16WF: usize = 102; +pub const R_PARISC_LTOFF16DF: usize = 103; +pub const R_PARISC_SECREL64: usize = 104; +pub const R_PARISC_SEGREL64: usize = 112; +pub const R_PARISC_PLTOFF14WR: usize = 115; +pub const R_PARISC_PLTOFF14DR: usize = 116; +pub const R_PARISC_PLTOFF16F: usize = 117; +pub const R_PARISC_PLTOFF16WF: usize = 118; +pub const R_PARISC_PLTOFF16DF: usize = 119; +pub const R_PARISC_LTOFF_FPTR64: usize = 120; +pub const R_PARISC_LTOFF_FPTR14WR: usize = 123; +pub const R_PARISC_LTOFF_FPTR14DR: usize = 124; +pub const R_PARISC_LTOFF_FPTR16F: usize = 125; +pub const R_PARISC_LTOFF_FPTR16WF: usize = 126; +pub const R_PARISC_LTOFF_FPTR16DF: usize = 127; +pub const R_PARISC_LORESERVE: usize = 128; +pub const R_PARISC_COPY: usize = 128; +pub const R_PARISC_IPLT: usize = 129; +pub const R_PARISC_EPLT: usize = 130; +pub const R_PARISC_TPREL32: usize = 153; +pub const R_PARISC_TPREL21L: usize = 154; +pub const R_PARISC_TPREL14R: usize = 158; +pub const R_PARISC_LTOFF_TP21L: usize = 162; +pub const R_PARISC_LTOFF_TP14R: usize = 166; +pub const R_PARISC_LTOFF_TP14F: usize = 167; +pub const R_PARISC_TPREL64: usize = 216; +pub const R_PARISC_TPREL14WR: usize = 219; +pub const R_PARISC_TPREL14DR: usize = 220; +pub const R_PARISC_TPREL16F: usize = 221; +pub const R_PARISC_TPREL16WF: usize = 222; +pub const R_PARISC_TPREL16DF: usize = 223; +pub const R_PARISC_LTOFF_TP64: usize = 224; +pub const R_PARISC_LTOFF_TP14WR: usize = 227; +pub const R_PARISC_LTOFF_TP14DR: usize = 228; +pub const R_PARISC_LTOFF_TP16F: usize = 229; +pub const R_PARISC_LTOFF_TP16WF: usize = 230; +pub const R_PARISC_LTOFF_TP16DF: usize = 231; +pub const R_PARISC_GNU_VTENTRY: usize = 232; +pub const R_PARISC_GNU_VTINHERIT: usize = 233; +pub const R_PARISC_TLS_GD21L: usize = 234; +pub const R_PARISC_TLS_GD14R: usize = 235; +pub const R_PARISC_TLS_GDCALL: usize = 236; +pub const R_PARISC_TLS_LDM21L: usize = 237; +pub const R_PARISC_TLS_LDM14R: usize = 238; +pub const R_PARISC_TLS_LDMCALL: usize = 239; +pub const R_PARISC_TLS_LDO21L: usize = 240; +pub const R_PARISC_TLS_LDO14R: usize = 241; +pub const R_PARISC_TLS_DTPMOD32: usize = 242; +pub const R_PARISC_TLS_DTPMOD64: usize = 243; +pub const R_PARISC_TLS_DTPOFF32: usize = 244; +pub const R_PARISC_TLS_DTPOFF64: usize = 245; +pub const R_PARISC_TLS_LE21L: usize = 154; +pub const R_PARISC_TLS_LE14R: usize = 158; +pub const R_PARISC_TLS_IE21L: usize = 162; +pub const R_PARISC_TLS_IE14R: usize = 166; +pub const R_PARISC_TLS_TPREL32: usize = 153; +pub const R_PARISC_TLS_TPREL64: usize = 216; +pub const R_PARISC_HIRESERVE: usize = 255; +pub const PT_HP_TLS: usize = 1610612736; +pub const PT_HP_CORE_NONE: usize = 1610612737; +pub const PT_HP_CORE_VERSION: usize = 1610612738; +pub const PT_HP_CORE_KERNEL: usize = 1610612739; +pub const PT_HP_CORE_COMM: usize = 1610612740; +pub const PT_HP_CORE_PROC: usize = 1610612741; +pub const PT_HP_CORE_LOADABLE: usize = 1610612742; +pub const PT_HP_CORE_STACK: usize = 1610612743; +pub const PT_HP_CORE_SHM: usize = 1610612744; +pub const PT_HP_CORE_MMF: usize = 1610612745; +pub const PT_HP_PARALLEL: usize = 1610612752; +pub const PT_HP_FASTBIND: usize = 1610612753; +pub const PT_HP_OPT_ANNOT: usize = 1610612754; +pub const PT_HP_HSL_ANNOT: usize = 1610612755; +pub const PT_HP_STACK: usize = 1610612756; +pub const PT_PARISC_ARCHEXT: usize = 1879048192; +pub const PT_PARISC_UNWIND: usize = 1879048193; +pub const PF_PARISC_SBP: usize = 134217728; +pub const PF_HP_PAGE_SIZE: usize = 1048576; +pub const PF_HP_FAR_SHARED: usize = 2097152; +pub const PF_HP_NEAR_SHARED: usize = 4194304; +pub const PF_HP_CODE: usize = 16777216; +pub const PF_HP_MODIFY: usize = 33554432; +pub const PF_HP_LAZYSWAP: usize = 67108864; +pub const PF_HP_SBP: usize = 134217728; +pub const EF_ALPHA_32BIT: usize = 1; +pub const EF_ALPHA_CANRELAX: usize = 2; +pub const SHT_ALPHA_DEBUG: usize = 1879048193; +pub const SHT_ALPHA_REGINFO: usize = 1879048194; +pub const SHF_ALPHA_GPREL: usize = 268435456; +pub const STO_ALPHA_NOPV: usize = 128; +pub const STO_ALPHA_STD_GPLOAD: usize = 136; +pub const R_ALPHA_NONE: usize = 0; +pub const R_ALPHA_REFLONG: usize = 1; +pub const R_ALPHA_REFQUAD: usize = 2; +pub const R_ALPHA_GPREL32: usize = 3; +pub const R_ALPHA_LITERAL: usize = 4; +pub const R_ALPHA_LITUSE: usize = 5; +pub const R_ALPHA_GPDISP: usize = 6; +pub const R_ALPHA_BRADDR: usize = 7; +pub const R_ALPHA_HINT: usize = 8; +pub const R_ALPHA_SREL16: usize = 9; +pub const R_ALPHA_SREL32: usize = 10; +pub const R_ALPHA_SREL64: usize = 11; +pub const R_ALPHA_GPRELHIGH: usize = 17; +pub const R_ALPHA_GPRELLOW: usize = 18; +pub const R_ALPHA_GPREL16: usize = 19; +pub const R_ALPHA_COPY: usize = 24; +pub const R_ALPHA_GLOB_DAT: usize = 25; +pub const R_ALPHA_JMP_SLOT: usize = 26; +pub const R_ALPHA_RELATIVE: usize = 27; +pub const R_ALPHA_TLS_GD_HI: usize = 28; +pub const R_ALPHA_TLSGD: usize = 29; +pub const R_ALPHA_TLS_LDM: usize = 30; +pub const R_ALPHA_DTPMOD64: usize = 31; +pub const R_ALPHA_GOTDTPREL: usize = 32; +pub const R_ALPHA_DTPREL64: usize = 33; +pub const R_ALPHA_DTPRELHI: usize = 34; +pub const R_ALPHA_DTPRELLO: usize = 35; +pub const R_ALPHA_DTPREL16: usize = 36; +pub const R_ALPHA_GOTTPREL: usize = 37; +pub const R_ALPHA_TPREL64: usize = 38; +pub const R_ALPHA_TPRELHI: usize = 39; +pub const R_ALPHA_TPRELLO: usize = 40; +pub const R_ALPHA_TPREL16: usize = 41; +pub const R_ALPHA_NUM: usize = 46; +pub const LITUSE_ALPHA_ADDR: usize = 0; +pub const LITUSE_ALPHA_BASE: usize = 1; +pub const LITUSE_ALPHA_BYTOFF: usize = 2; +pub const LITUSE_ALPHA_JSR: usize = 3; +pub const LITUSE_ALPHA_TLS_GD: usize = 4; +pub const LITUSE_ALPHA_TLS_LDM: usize = 5; +pub const DT_ALPHA_PLTRO: usize = 1879048192; +pub const DT_ALPHA_NUM: usize = 1; +pub const EF_PPC_EMB: usize = 2147483648; +pub const EF_PPC_RELOCATABLE: usize = 65536; +pub const EF_PPC_RELOCATABLE_LIB: usize = 32768; +pub const R_PPC_NONE: usize = 0; +pub const R_PPC_ADDR32: usize = 1; +pub const R_PPC_ADDR24: usize = 2; +pub const R_PPC_ADDR16: usize = 3; +pub const R_PPC_ADDR16_LO: usize = 4; +pub const R_PPC_ADDR16_HI: usize = 5; +pub const R_PPC_ADDR16_HA: usize = 6; +pub const R_PPC_ADDR14: usize = 7; +pub const R_PPC_ADDR14_BRTAKEN: usize = 8; +pub const R_PPC_ADDR14_BRNTAKEN: usize = 9; +pub const R_PPC_REL24: usize = 10; +pub const R_PPC_REL14: usize = 11; +pub const R_PPC_REL14_BRTAKEN: usize = 12; +pub const R_PPC_REL14_BRNTAKEN: usize = 13; +pub const R_PPC_GOT16: usize = 14; +pub const R_PPC_GOT16_LO: usize = 15; +pub const R_PPC_GOT16_HI: usize = 16; +pub const R_PPC_GOT16_HA: usize = 17; +pub const R_PPC_PLTREL24: usize = 18; +pub const R_PPC_COPY: usize = 19; +pub const R_PPC_GLOB_DAT: usize = 20; +pub const R_PPC_JMP_SLOT: usize = 21; +pub const R_PPC_RELATIVE: usize = 22; +pub const R_PPC_LOCAL24PC: usize = 23; +pub const R_PPC_UADDR32: usize = 24; +pub const R_PPC_UADDR16: usize = 25; +pub const R_PPC_REL32: usize = 26; +pub const R_PPC_PLT32: usize = 27; +pub const R_PPC_PLTREL32: usize = 28; +pub const R_PPC_PLT16_LO: usize = 29; +pub const R_PPC_PLT16_HI: usize = 30; +pub const R_PPC_PLT16_HA: usize = 31; +pub const R_PPC_SDAREL16: usize = 32; +pub const R_PPC_SECTOFF: usize = 33; +pub const R_PPC_SECTOFF_LO: usize = 34; +pub const R_PPC_SECTOFF_HI: usize = 35; +pub const R_PPC_SECTOFF_HA: usize = 36; +pub const R_PPC_TLS: usize = 67; +pub const R_PPC_DTPMOD32: usize = 68; +pub const R_PPC_TPREL16: usize = 69; +pub const R_PPC_TPREL16_LO: usize = 70; +pub const R_PPC_TPREL16_HI: usize = 71; +pub const R_PPC_TPREL16_HA: usize = 72; +pub const R_PPC_TPREL32: usize = 73; +pub const R_PPC_DTPREL16: usize = 74; +pub const R_PPC_DTPREL16_LO: usize = 75; +pub const R_PPC_DTPREL16_HI: usize = 76; +pub const R_PPC_DTPREL16_HA: usize = 77; +pub const R_PPC_DTPREL32: usize = 78; +pub const R_PPC_GOT_TLSGD16: usize = 79; +pub const R_PPC_GOT_TLSGD16_LO: usize = 80; +pub const R_PPC_GOT_TLSGD16_HI: usize = 81; +pub const R_PPC_GOT_TLSGD16_HA: usize = 82; +pub const R_PPC_GOT_TLSLD16: usize = 83; +pub const R_PPC_GOT_TLSLD16_LO: usize = 84; +pub const R_PPC_GOT_TLSLD16_HI: usize = 85; +pub const R_PPC_GOT_TLSLD16_HA: usize = 86; +pub const R_PPC_GOT_TPREL16: usize = 87; +pub const R_PPC_GOT_TPREL16_LO: usize = 88; +pub const R_PPC_GOT_TPREL16_HI: usize = 89; +pub const R_PPC_GOT_TPREL16_HA: usize = 90; +pub const R_PPC_GOT_DTPREL16: usize = 91; +pub const R_PPC_GOT_DTPREL16_LO: usize = 92; +pub const R_PPC_GOT_DTPREL16_HI: usize = 93; +pub const R_PPC_GOT_DTPREL16_HA: usize = 94; +pub const R_PPC_EMB_NADDR32: usize = 101; +pub const R_PPC_EMB_NADDR16: usize = 102; +pub const R_PPC_EMB_NADDR16_LO: usize = 103; +pub const R_PPC_EMB_NADDR16_HI: usize = 104; +pub const R_PPC_EMB_NADDR16_HA: usize = 105; +pub const R_PPC_EMB_SDAI16: usize = 106; +pub const R_PPC_EMB_SDA2I16: usize = 107; +pub const R_PPC_EMB_SDA2REL: usize = 108; +pub const R_PPC_EMB_SDA21: usize = 109; +pub const R_PPC_EMB_MRKREF: usize = 110; +pub const R_PPC_EMB_RELSEC16: usize = 111; +pub const R_PPC_EMB_RELST_LO: usize = 112; +pub const R_PPC_EMB_RELST_HI: usize = 113; +pub const R_PPC_EMB_RELST_HA: usize = 114; +pub const R_PPC_EMB_BIT_FLD: usize = 115; +pub const R_PPC_EMB_RELSDA: usize = 116; +pub const R_PPC_DIAB_SDA21_LO: usize = 180; +pub const R_PPC_DIAB_SDA21_HI: usize = 181; +pub const R_PPC_DIAB_SDA21_HA: usize = 182; +pub const R_PPC_DIAB_RELSDA_LO: usize = 183; +pub const R_PPC_DIAB_RELSDA_HI: usize = 184; +pub const R_PPC_DIAB_RELSDA_HA: usize = 185; +pub const R_PPC_IRELATIVE: usize = 248; +pub const R_PPC_REL16: usize = 249; +pub const R_PPC_REL16_LO: usize = 250; +pub const R_PPC_REL16_HI: usize = 251; +pub const R_PPC_REL16_HA: usize = 252; +pub const R_PPC_TOC16: usize = 255; +pub const DT_PPC_GOT: usize = 1879048192; +pub const DT_PPC_NUM: usize = 1; +pub const R_PPC64_NONE: usize = 0; +pub const R_PPC64_ADDR32: usize = 1; +pub const R_PPC64_ADDR24: usize = 2; +pub const R_PPC64_ADDR16: usize = 3; +pub const R_PPC64_ADDR16_LO: usize = 4; +pub const R_PPC64_ADDR16_HI: usize = 5; +pub const R_PPC64_ADDR16_HA: usize = 6; +pub const R_PPC64_ADDR14: usize = 7; +pub const R_PPC64_ADDR14_BRTAKEN: usize = 8; +pub const R_PPC64_ADDR14_BRNTAKEN: usize = 9; +pub const R_PPC64_REL24: usize = 10; +pub const R_PPC64_REL14: usize = 11; +pub const R_PPC64_REL14_BRTAKEN: usize = 12; +pub const R_PPC64_REL14_BRNTAKEN: usize = 13; +pub const R_PPC64_GOT16: usize = 14; +pub const R_PPC64_GOT16_LO: usize = 15; +pub const R_PPC64_GOT16_HI: usize = 16; +pub const R_PPC64_GOT16_HA: usize = 17; +pub const R_PPC64_COPY: usize = 19; +pub const R_PPC64_GLOB_DAT: usize = 20; +pub const R_PPC64_JMP_SLOT: usize = 21; +pub const R_PPC64_RELATIVE: usize = 22; +pub const R_PPC64_UADDR32: usize = 24; +pub const R_PPC64_UADDR16: usize = 25; +pub const R_PPC64_REL32: usize = 26; +pub const R_PPC64_PLT32: usize = 27; +pub const R_PPC64_PLTREL32: usize = 28; +pub const R_PPC64_PLT16_LO: usize = 29; +pub const R_PPC64_PLT16_HI: usize = 30; +pub const R_PPC64_PLT16_HA: usize = 31; +pub const R_PPC64_SECTOFF: usize = 33; +pub const R_PPC64_SECTOFF_LO: usize = 34; +pub const R_PPC64_SECTOFF_HI: usize = 35; +pub const R_PPC64_SECTOFF_HA: usize = 36; +pub const R_PPC64_ADDR30: usize = 37; +pub const R_PPC64_ADDR64: usize = 38; +pub const R_PPC64_ADDR16_HIGHER: usize = 39; +pub const R_PPC64_ADDR16_HIGHERA: usize = 40; +pub const R_PPC64_ADDR16_HIGHEST: usize = 41; +pub const R_PPC64_ADDR16_HIGHESTA: usize = 42; +pub const R_PPC64_UADDR64: usize = 43; +pub const R_PPC64_REL64: usize = 44; +pub const R_PPC64_PLT64: usize = 45; +pub const R_PPC64_PLTREL64: usize = 46; +pub const R_PPC64_TOC16: usize = 47; +pub const R_PPC64_TOC16_LO: usize = 48; +pub const R_PPC64_TOC16_HI: usize = 49; +pub const R_PPC64_TOC16_HA: usize = 50; +pub const R_PPC64_TOC: usize = 51; +pub const R_PPC64_PLTGOT16: usize = 52; +pub const R_PPC64_PLTGOT16_LO: usize = 53; +pub const R_PPC64_PLTGOT16_HI: usize = 54; +pub const R_PPC64_PLTGOT16_HA: usize = 55; +pub const R_PPC64_ADDR16_DS: usize = 56; +pub const R_PPC64_ADDR16_LO_DS: usize = 57; +pub const R_PPC64_GOT16_DS: usize = 58; +pub const R_PPC64_GOT16_LO_DS: usize = 59; +pub const R_PPC64_PLT16_LO_DS: usize = 60; +pub const R_PPC64_SECTOFF_DS: usize = 61; +pub const R_PPC64_SECTOFF_LO_DS: usize = 62; +pub const R_PPC64_TOC16_DS: usize = 63; +pub const R_PPC64_TOC16_LO_DS: usize = 64; +pub const R_PPC64_PLTGOT16_DS: usize = 65; +pub const R_PPC64_PLTGOT16_LO_DS: usize = 66; +pub const R_PPC64_TLS: usize = 67; +pub const R_PPC64_DTPMOD64: usize = 68; +pub const R_PPC64_TPREL16: usize = 69; +pub const R_PPC64_TPREL16_LO: usize = 70; +pub const R_PPC64_TPREL16_HI: usize = 71; +pub const R_PPC64_TPREL16_HA: usize = 72; +pub const R_PPC64_TPREL64: usize = 73; +pub const R_PPC64_DTPREL16: usize = 74; +pub const R_PPC64_DTPREL16_LO: usize = 75; +pub const R_PPC64_DTPREL16_HI: usize = 76; +pub const R_PPC64_DTPREL16_HA: usize = 77; +pub const R_PPC64_DTPREL64: usize = 78; +pub const R_PPC64_GOT_TLSGD16: usize = 79; +pub const R_PPC64_GOT_TLSGD16_LO: usize = 80; +pub const R_PPC64_GOT_TLSGD16_HI: usize = 81; +pub const R_PPC64_GOT_TLSGD16_HA: usize = 82; +pub const R_PPC64_GOT_TLSLD16: usize = 83; +pub const R_PPC64_GOT_TLSLD16_LO: usize = 84; +pub const R_PPC64_GOT_TLSLD16_HI: usize = 85; +pub const R_PPC64_GOT_TLSLD16_HA: usize = 86; +pub const R_PPC64_GOT_TPREL16_DS: usize = 87; +pub const R_PPC64_GOT_TPREL16_LO_DS: usize = 88; +pub const R_PPC64_GOT_TPREL16_HI: usize = 89; +pub const R_PPC64_GOT_TPREL16_HA: usize = 90; +pub const R_PPC64_GOT_DTPREL16_DS: usize = 91; +pub const R_PPC64_GOT_DTPREL16_LO_DS: usize = 92; +pub const R_PPC64_GOT_DTPREL16_HI: usize = 93; +pub const R_PPC64_GOT_DTPREL16_HA: usize = 94; +pub const R_PPC64_TPREL16_DS: usize = 95; +pub const R_PPC64_TPREL16_LO_DS: usize = 96; +pub const R_PPC64_TPREL16_HIGHER: usize = 97; +pub const R_PPC64_TPREL16_HIGHERA: usize = 98; +pub const R_PPC64_TPREL16_HIGHEST: usize = 99; +pub const R_PPC64_TPREL16_HIGHESTA: usize = 100; +pub const R_PPC64_DTPREL16_DS: usize = 101; +pub const R_PPC64_DTPREL16_LO_DS: usize = 102; +pub const R_PPC64_DTPREL16_HIGHER: usize = 103; +pub const R_PPC64_DTPREL16_HIGHERA: usize = 104; +pub const R_PPC64_DTPREL16_HIGHEST: usize = 105; +pub const R_PPC64_DTPREL16_HIGHESTA: usize = 106; +pub const R_PPC64_TLSGD: usize = 107; +pub const R_PPC64_TLSLD: usize = 108; +pub const R_PPC64_TOCSAVE: usize = 109; +pub const R_PPC64_ADDR16_HIGH: usize = 110; +pub const R_PPC64_ADDR16_HIGHA: usize = 111; +pub const R_PPC64_TPREL16_HIGH: usize = 112; +pub const R_PPC64_TPREL16_HIGHA: usize = 113; +pub const R_PPC64_DTPREL16_HIGH: usize = 114; +pub const R_PPC64_DTPREL16_HIGHA: usize = 115; +pub const R_PPC64_JMP_IREL: usize = 247; +pub const R_PPC64_IRELATIVE: usize = 248; +pub const R_PPC64_REL16: usize = 249; +pub const R_PPC64_REL16_LO: usize = 250; +pub const R_PPC64_REL16_HI: usize = 251; +pub const R_PPC64_REL16_HA: usize = 252; +pub const EF_PPC64_ABI: usize = 3; +pub const DT_PPC64_GLINK: usize = 1879048192; +pub const DT_PPC64_OPD: usize = 1879048193; +pub const DT_PPC64_OPDSZ: usize = 1879048194; +pub const DT_PPC64_OPT: usize = 1879048195; +pub const DT_PPC64_NUM: usize = 3; +pub const PPC64_OPT_TLS: usize = 1; +pub const PPC64_OPT_MULTI_TOC: usize = 2; +pub const STO_PPC64_LOCAL_BIT: usize = 5; +pub const STO_PPC64_LOCAL_MASK: usize = 224; +pub const EF_ARM_RELEXEC: usize = 1; +pub const EF_ARM_HASENTRY: usize = 2; +pub const EF_ARM_INTERWORK: usize = 4; +pub const EF_ARM_APCS_26: usize = 8; +pub const EF_ARM_APCS_FLOAT: usize = 16; +pub const EF_ARM_PIC: usize = 32; +pub const EF_ARM_ALIGN8: usize = 64; +pub const EF_ARM_NEW_ABI: usize = 128; +pub const EF_ARM_OLD_ABI: usize = 256; +pub const EF_ARM_SOFT_FLOAT: usize = 512; +pub const EF_ARM_VFP_FLOAT: usize = 1024; +pub const EF_ARM_MAVERICK_FLOAT: usize = 2048; +pub const EF_ARM_ABI_FLOAT_SOFT: usize = 512; +pub const EF_ARM_ABI_FLOAT_HARD: usize = 1024; +pub const EF_ARM_SYMSARESORTED: usize = 4; +pub const EF_ARM_DYNSYMSUSESEGIDX: usize = 8; +pub const EF_ARM_MAPSYMSFIRST: usize = 16; +pub const EF_ARM_BE8: usize = 8388608; +pub const EF_ARM_LE8: usize = 4194304; +pub const EF_ARM_EABI_UNKNOWN: usize = 0; +pub const EF_ARM_EABI_VER1: usize = 16777216; +pub const EF_ARM_EABI_VER2: usize = 33554432; +pub const EF_ARM_EABI_VER3: usize = 50331648; +pub const EF_ARM_EABI_VER4: usize = 67108864; +pub const EF_ARM_EABI_VER5: usize = 83886080; +pub const STT_ARM_TFUNC: usize = 13; +pub const STT_ARM_16BIT: usize = 15; +pub const SHF_ARM_ENTRYSECT: usize = 268435456; +pub const SHF_ARM_COMDEF: usize = 2147483648; +pub const PF_ARM_SB: usize = 268435456; +pub const PF_ARM_PI: usize = 536870912; +pub const PF_ARM_ABS: usize = 1073741824; +pub const PT_ARM_EXIDX: usize = 1879048193; +pub const SHT_ARM_EXIDX: usize = 1879048193; +pub const SHT_ARM_PREEMPTMAP: usize = 1879048194; +pub const SHT_ARM_ATTRIBUTES: usize = 1879048195; +pub const R_AARCH64_NONE: usize = 0; +pub const R_AARCH64_ABS64: usize = 257; +pub const R_AARCH64_ABS32: usize = 258; +pub const R_AARCH64_ABS16: usize = 259; +pub const R_AARCH64_PREL64: usize = 260; +pub const R_AARCH64_PREL32: usize = 261; +pub const R_AARCH64_PREL16: usize = 262; +pub const R_AARCH64_MOVW_UABS_G0: usize = 263; +pub const R_AARCH64_MOVW_UABS_G0_NC: usize = 264; +pub const R_AARCH64_MOVW_UABS_G1: usize = 265; +pub const R_AARCH64_MOVW_UABS_G1_NC: usize = 266; +pub const R_AARCH64_MOVW_UABS_G2: usize = 267; +pub const R_AARCH64_MOVW_UABS_G2_NC: usize = 268; +pub const R_AARCH64_MOVW_UABS_G3: usize = 269; +pub const R_AARCH64_MOVW_SABS_G0: usize = 270; +pub const R_AARCH64_MOVW_SABS_G1: usize = 271; +pub const R_AARCH64_MOVW_SABS_G2: usize = 272; +pub const R_AARCH64_LD_PREL_LO19: usize = 273; +pub const R_AARCH64_ADR_PREL_LO21: usize = 274; +pub const R_AARCH64_ADR_PREL_PG_HI21: usize = 275; +pub const R_AARCH64_ADR_PREL_PG_HI21_NC: usize = 276; +pub const R_AARCH64_ADD_ABS_LO12_NC: usize = 277; +pub const R_AARCH64_LDST8_ABS_LO12_NC: usize = 278; +pub const R_AARCH64_TSTBR14: usize = 279; +pub const R_AARCH64_CONDBR19: usize = 280; +pub const R_AARCH64_JUMP26: usize = 282; +pub const R_AARCH64_CALL26: usize = 283; +pub const R_AARCH64_LDST16_ABS_LO12_NC: usize = 284; +pub const R_AARCH64_LDST32_ABS_LO12_NC: usize = 285; +pub const R_AARCH64_LDST64_ABS_LO12_NC: usize = 286; +pub const R_AARCH64_MOVW_PREL_G0: usize = 287; +pub const R_AARCH64_MOVW_PREL_G0_NC: usize = 288; +pub const R_AARCH64_MOVW_PREL_G1: usize = 289; +pub const R_AARCH64_MOVW_PREL_G1_NC: usize = 290; +pub const R_AARCH64_MOVW_PREL_G2: usize = 291; +pub const R_AARCH64_MOVW_PREL_G2_NC: usize = 292; +pub const R_AARCH64_MOVW_PREL_G3: usize = 293; +pub const R_AARCH64_LDST128_ABS_LO12_NC: usize = 299; +pub const R_AARCH64_MOVW_GOTOFF_G0: usize = 300; +pub const R_AARCH64_MOVW_GOTOFF_G0_NC: usize = 301; +pub const R_AARCH64_MOVW_GOTOFF_G1: usize = 302; +pub const R_AARCH64_MOVW_GOTOFF_G1_NC: usize = 303; +pub const R_AARCH64_MOVW_GOTOFF_G2: usize = 304; +pub const R_AARCH64_MOVW_GOTOFF_G2_NC: usize = 305; +pub const R_AARCH64_MOVW_GOTOFF_G3: usize = 306; +pub const R_AARCH64_GOTREL64: usize = 307; +pub const R_AARCH64_GOTREL32: usize = 308; +pub const R_AARCH64_GOT_LD_PREL19: usize = 309; +pub const R_AARCH64_LD64_GOTOFF_LO15: usize = 310; +pub const R_AARCH64_ADR_GOT_PAGE: usize = 311; +pub const R_AARCH64_LD64_GOT_LO12_NC: usize = 312; +pub const R_AARCH64_LD64_GOTPAGE_LO15: usize = 313; +pub const R_AARCH64_TLSGD_ADR_PREL21: usize = 512; +pub const R_AARCH64_TLSGD_ADR_PAGE21: usize = 513; +pub const R_AARCH64_TLSGD_ADD_LO12_NC: usize = 514; +pub const R_AARCH64_TLSGD_MOVW_G1: usize = 515; +pub const R_AARCH64_TLSGD_MOVW_G0_NC: usize = 516; +pub const R_AARCH64_TLSLD_ADR_PREL21: usize = 517; +pub const R_AARCH64_TLSLD_ADR_PAGE21: usize = 518; +pub const R_AARCH64_TLSLD_ADD_LO12_NC: usize = 519; +pub const R_AARCH64_TLSLD_MOVW_G1: usize = 520; +pub const R_AARCH64_TLSLD_MOVW_G0_NC: usize = 521; +pub const R_AARCH64_TLSLD_LD_PREL19: usize = 522; +pub const R_AARCH64_TLSLD_MOVW_DTPREL_G2: usize = 523; +pub const R_AARCH64_TLSLD_MOVW_DTPREL_G1: usize = 524; +pub const R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC: usize = 525; +pub const R_AARCH64_TLSLD_MOVW_DTPREL_G0: usize = 526; +pub const R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: usize = 527; +pub const R_AARCH64_TLSLD_ADD_DTPREL_HI12: usize = 528; +pub const R_AARCH64_TLSLD_ADD_DTPREL_LO12: usize = 529; +pub const R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC: usize = 530; +pub const R_AARCH64_TLSLD_LDST8_DTPREL_LO12: usize = 531; +pub const R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC: usize = 532; +pub const R_AARCH64_TLSLD_LDST16_DTPREL_LO12: usize = 533; +pub const R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC: usize = 534; +pub const R_AARCH64_TLSLD_LDST32_DTPREL_LO12: usize = 535; +pub const R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC: usize = 536; +pub const R_AARCH64_TLSLD_LDST64_DTPREL_LO12: usize = 537; +pub const R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC: usize = 538; +pub const R_AARCH64_TLSIE_MOVW_GOTTPREL_G1: usize = 539; +pub const R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC: usize = 540; +pub const R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: usize = 541; +pub const R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: usize = 542; +pub const R_AARCH64_TLSIE_LD_GOTTPREL_PREL19: usize = 543; +pub const R_AARCH64_TLSLE_MOVW_TPREL_G2: usize = 544; +pub const R_AARCH64_TLSLE_MOVW_TPREL_G1: usize = 545; +pub const R_AARCH64_TLSLE_MOVW_TPREL_G1_NC: usize = 546; +pub const R_AARCH64_TLSLE_MOVW_TPREL_G0: usize = 547; +pub const R_AARCH64_TLSLE_MOVW_TPREL_G0_NC: usize = 548; +pub const R_AARCH64_TLSLE_ADD_TPREL_HI12: usize = 549; +pub const R_AARCH64_TLSLE_ADD_TPREL_LO12: usize = 550; +pub const R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: usize = 551; +pub const R_AARCH64_TLSLE_LDST8_TPREL_LO12: usize = 552; +pub const R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: usize = 553; +pub const R_AARCH64_TLSLE_LDST16_TPREL_LO12: usize = 554; +pub const R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: usize = 555; +pub const R_AARCH64_TLSLE_LDST32_TPREL_LO12: usize = 556; +pub const R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: usize = 557; +pub const R_AARCH64_TLSLE_LDST64_TPREL_LO12: usize = 558; +pub const R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: usize = 559; +pub const R_AARCH64_TLSDESC_LD_PREL19: usize = 560; +pub const R_AARCH64_TLSDESC_ADR_PREL21: usize = 561; +pub const R_AARCH64_TLSDESC_ADR_PAGE21: usize = 562; +pub const R_AARCH64_TLSDESC_LD64_LO12: usize = 563; +pub const R_AARCH64_TLSDESC_ADD_LO12: usize = 564; +pub const R_AARCH64_TLSDESC_OFF_G1: usize = 565; +pub const R_AARCH64_TLSDESC_OFF_G0_NC: usize = 566; +pub const R_AARCH64_TLSDESC_LDR: usize = 567; +pub const R_AARCH64_TLSDESC_ADD: usize = 568; +pub const R_AARCH64_TLSDESC_CALL: usize = 569; +pub const R_AARCH64_TLSLE_LDST128_TPREL_LO12: usize = 570; +pub const R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC: usize = 571; +pub const R_AARCH64_TLSLD_LDST128_DTPREL_LO12: usize = 572; +pub const R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC: usize = + 573; +pub const R_AARCH64_COPY: usize = 1024; +pub const R_AARCH64_GLOB_DAT: usize = 1025; +pub const R_AARCH64_JUMP_SLOT: usize = 1026; +pub const R_AARCH64_RELATIVE: usize = 1027; +pub const R_AARCH64_TLS_DTPMOD64: usize = 1028; +pub const R_AARCH64_TLS_DTPREL64: usize = 1029; +pub const R_AARCH64_TLS_TPREL64: usize = 1030; +pub const R_AARCH64_TLSDESC: usize = 1031; +pub const R_AARCH64_IRELATIVE: usize = 1032; +pub const R_ARM_NONE: usize = 0; +pub const R_ARM_PC24: usize = 1; +pub const R_ARM_ABS32: usize = 2; +pub const R_ARM_REL32: usize = 3; +pub const R_ARM_PC13: usize = 4; +pub const R_ARM_ABS16: usize = 5; +pub const R_ARM_ABS12: usize = 6; +pub const R_ARM_THM_ABS5: usize = 7; +pub const R_ARM_ABS8: usize = 8; +pub const R_ARM_SBREL32: usize = 9; +pub const R_ARM_THM_PC22: usize = 10; +pub const R_ARM_THM_PC8: usize = 11; +pub const R_ARM_AMP_VCALL9: usize = 12; +pub const R_ARM_SWI24: usize = 13; +pub const R_ARM_TLS_DESC: usize = 13; +pub const R_ARM_THM_SWI8: usize = 14; +pub const R_ARM_XPC25: usize = 15; +pub const R_ARM_THM_XPC22: usize = 16; +pub const R_ARM_TLS_DTPMOD32: usize = 17; +pub const R_ARM_TLS_DTPOFF32: usize = 18; +pub const R_ARM_TLS_TPOFF32: usize = 19; +pub const R_ARM_COPY: usize = 20; +pub const R_ARM_GLOB_DAT: usize = 21; +pub const R_ARM_JUMP_SLOT: usize = 22; +pub const R_ARM_RELATIVE: usize = 23; +pub const R_ARM_GOTOFF: usize = 24; +pub const R_ARM_GOTPC: usize = 25; +pub const R_ARM_GOT32: usize = 26; +pub const R_ARM_PLT32: usize = 27; +pub const R_ARM_CALL: usize = 28; +pub const R_ARM_JUMP24: usize = 29; +pub const R_ARM_THM_JUMP24: usize = 30; +pub const R_ARM_BASE_ABS: usize = 31; +pub const R_ARM_ALU_PCREL_7_0: usize = 32; +pub const R_ARM_ALU_PCREL_15_8: usize = 33; +pub const R_ARM_ALU_PCREL_23_15: usize = 34; +pub const R_ARM_LDR_SBREL_11_0: usize = 35; +pub const R_ARM_ALU_SBREL_19_12: usize = 36; +pub const R_ARM_ALU_SBREL_27_20: usize = 37; +pub const R_ARM_TARGET1: usize = 38; +pub const R_ARM_SBREL31: usize = 39; +pub const R_ARM_V4BX: usize = 40; +pub const R_ARM_TARGET2: usize = 41; +pub const R_ARM_PREL31: usize = 42; +pub const R_ARM_MOVW_ABS_NC: usize = 43; +pub const R_ARM_MOVT_ABS: usize = 44; +pub const R_ARM_MOVW_PREL_NC: usize = 45; +pub const R_ARM_MOVT_PREL: usize = 46; +pub const R_ARM_THM_MOVW_ABS_NC: usize = 47; +pub const R_ARM_THM_MOVT_ABS: usize = 48; +pub const R_ARM_THM_MOVW_PREL_NC: usize = 49; +pub const R_ARM_THM_MOVT_PREL: usize = 50; +pub const R_ARM_THM_JUMP19: usize = 51; +pub const R_ARM_THM_JUMP6: usize = 52; +pub const R_ARM_THM_ALU_PREL_11_0: usize = 53; +pub const R_ARM_THM_PC12: usize = 54; +pub const R_ARM_ABS32_NOI: usize = 55; +pub const R_ARM_REL32_NOI: usize = 56; +pub const R_ARM_ALU_PC_G0_NC: usize = 57; +pub const R_ARM_ALU_PC_G0: usize = 58; +pub const R_ARM_ALU_PC_G1_NC: usize = 59; +pub const R_ARM_ALU_PC_G1: usize = 60; +pub const R_ARM_ALU_PC_G2: usize = 61; +pub const R_ARM_LDR_PC_G1: usize = 62; +pub const R_ARM_LDR_PC_G2: usize = 63; +pub const R_ARM_LDRS_PC_G0: usize = 64; +pub const R_ARM_LDRS_PC_G1: usize = 65; +pub const R_ARM_LDRS_PC_G2: usize = 66; +pub const R_ARM_LDC_PC_G0: usize = 67; +pub const R_ARM_LDC_PC_G1: usize = 68; +pub const R_ARM_LDC_PC_G2: usize = 69; +pub const R_ARM_ALU_SB_G0_NC: usize = 70; +pub const R_ARM_ALU_SB_G0: usize = 71; +pub const R_ARM_ALU_SB_G1_NC: usize = 72; +pub const R_ARM_ALU_SB_G1: usize = 73; +pub const R_ARM_ALU_SB_G2: usize = 74; +pub const R_ARM_LDR_SB_G0: usize = 75; +pub const R_ARM_LDR_SB_G1: usize = 76; +pub const R_ARM_LDR_SB_G2: usize = 77; +pub const R_ARM_LDRS_SB_G0: usize = 78; +pub const R_ARM_LDRS_SB_G1: usize = 79; +pub const R_ARM_LDRS_SB_G2: usize = 80; +pub const R_ARM_LDC_SB_G0: usize = 81; +pub const R_ARM_LDC_SB_G1: usize = 82; +pub const R_ARM_LDC_SB_G2: usize = 83; +pub const R_ARM_MOVW_BREL_NC: usize = 84; +pub const R_ARM_MOVT_BREL: usize = 85; +pub const R_ARM_MOVW_BREL: usize = 86; +pub const R_ARM_THM_MOVW_BREL_NC: usize = 87; +pub const R_ARM_THM_MOVT_BREL: usize = 88; +pub const R_ARM_THM_MOVW_BREL: usize = 89; +pub const R_ARM_TLS_GOTDESC: usize = 90; +pub const R_ARM_TLS_CALL: usize = 91; +pub const R_ARM_TLS_DESCSEQ: usize = 92; +pub const R_ARM_THM_TLS_CALL: usize = 93; +pub const R_ARM_PLT32_ABS: usize = 94; +pub const R_ARM_GOT_ABS: usize = 95; +pub const R_ARM_GOT_PREL: usize = 96; +pub const R_ARM_GOT_BREL12: usize = 97; +pub const R_ARM_GOTOFF12: usize = 98; +pub const R_ARM_GOTRELAX: usize = 99; +pub const R_ARM_GNU_VTENTRY: usize = 100; +pub const R_ARM_GNU_VTINHERIT: usize = 101; +pub const R_ARM_THM_PC11: usize = 102; +pub const R_ARM_THM_PC9: usize = 103; +pub const R_ARM_TLS_GD32: usize = 104; +pub const R_ARM_TLS_LDM32: usize = 105; +pub const R_ARM_TLS_LDO32: usize = 106; +pub const R_ARM_TLS_IE32: usize = 107; +pub const R_ARM_TLS_LE32: usize = 108; +pub const R_ARM_TLS_LDO12: usize = 109; +pub const R_ARM_TLS_LE12: usize = 110; +pub const R_ARM_TLS_IE12GP: usize = 111; +pub const R_ARM_ME_TOO: usize = 128; +pub const R_ARM_THM_TLS_DESCSEQ: usize = 129; +pub const R_ARM_THM_TLS_DESCSEQ16: usize = 129; +pub const R_ARM_THM_TLS_DESCSEQ32: usize = 130; +pub const R_ARM_THM_GOT_BREL12: usize = 131; +pub const R_ARM_IRELATIVE: usize = 160; +pub const R_ARM_RXPC25: usize = 249; +pub const R_ARM_RSBREL32: usize = 250; +pub const R_ARM_THM_RPC22: usize = 251; +pub const R_ARM_RREL32: usize = 252; +pub const R_ARM_RABS22: usize = 253; +pub const R_ARM_RPC24: usize = 254; +pub const R_ARM_RBASE: usize = 255; +pub const R_ARM_NUM: usize = 256; +pub const EF_IA_64_MASKOS: usize = 15; +pub const EF_IA_64_ABI64: usize = 16; +pub const EF_IA_64_ARCH: usize = 4278190080; +pub const PT_IA_64_ARCHEXT: usize = 1879048192; +pub const PT_IA_64_UNWIND: usize = 1879048193; +pub const PT_IA_64_HP_OPT_ANOT: usize = 1610612754; +pub const PT_IA_64_HP_HSL_ANOT: usize = 1610612755; +pub const PT_IA_64_HP_STACK: usize = 1610612756; +pub const PF_IA_64_NORECOV: usize = 2147483648; +pub const SHT_IA_64_EXT: usize = 1879048192; +pub const SHT_IA_64_UNWIND: usize = 1879048193; +pub const SHF_IA_64_SHORT: usize = 268435456; +pub const SHF_IA_64_NORECOV: usize = 536870912; +pub const DT_IA_64_PLT_RESERVE: usize = 1879048192; +pub const DT_IA_64_NUM: usize = 1; +pub const R_IA64_NONE: usize = 0; +pub const R_IA64_IMM14: usize = 33; +pub const R_IA64_IMM22: usize = 34; +pub const R_IA64_IMM64: usize = 35; +pub const R_IA64_DIR32MSB: usize = 36; +pub const R_IA64_DIR32LSB: usize = 37; +pub const R_IA64_DIR64MSB: usize = 38; +pub const R_IA64_DIR64LSB: usize = 39; +pub const R_IA64_GPREL22: usize = 42; +pub const R_IA64_GPREL64I: usize = 43; +pub const R_IA64_GPREL32MSB: usize = 44; +pub const R_IA64_GPREL32LSB: usize = 45; +pub const R_IA64_GPREL64MSB: usize = 46; +pub const R_IA64_GPREL64LSB: usize = 47; +pub const R_IA64_LTOFF22: usize = 50; +pub const R_IA64_LTOFF64I: usize = 51; +pub const R_IA64_PLTOFF22: usize = 58; +pub const R_IA64_PLTOFF64I: usize = 59; +pub const R_IA64_PLTOFF64MSB: usize = 62; +pub const R_IA64_PLTOFF64LSB: usize = 63; +pub const R_IA64_FPTR64I: usize = 67; +pub const R_IA64_FPTR32MSB: usize = 68; +pub const R_IA64_FPTR32LSB: usize = 69; +pub const R_IA64_FPTR64MSB: usize = 70; +pub const R_IA64_FPTR64LSB: usize = 71; +pub const R_IA64_PCREL60B: usize = 72; +pub const R_IA64_PCREL21B: usize = 73; +pub const R_IA64_PCREL21M: usize = 74; +pub const R_IA64_PCREL21F: usize = 75; +pub const R_IA64_PCREL32MSB: usize = 76; +pub const R_IA64_PCREL32LSB: usize = 77; +pub const R_IA64_PCREL64MSB: usize = 78; +pub const R_IA64_PCREL64LSB: usize = 79; +pub const R_IA64_LTOFF_FPTR22: usize = 82; +pub const R_IA64_LTOFF_FPTR64I: usize = 83; +pub const R_IA64_LTOFF_FPTR32MSB: usize = 84; +pub const R_IA64_LTOFF_FPTR32LSB: usize = 85; +pub const R_IA64_LTOFF_FPTR64MSB: usize = 86; +pub const R_IA64_LTOFF_FPTR64LSB: usize = 87; +pub const R_IA64_SEGREL32MSB: usize = 92; +pub const R_IA64_SEGREL32LSB: usize = 93; +pub const R_IA64_SEGREL64MSB: usize = 94; +pub const R_IA64_SEGREL64LSB: usize = 95; +pub const R_IA64_SECREL32MSB: usize = 100; +pub const R_IA64_SECREL32LSB: usize = 101; +pub const R_IA64_SECREL64MSB: usize = 102; +pub const R_IA64_SECREL64LSB: usize = 103; +pub const R_IA64_REL32MSB: usize = 108; +pub const R_IA64_REL32LSB: usize = 109; +pub const R_IA64_REL64MSB: usize = 110; +pub const R_IA64_REL64LSB: usize = 111; +pub const R_IA64_LTV32MSB: usize = 116; +pub const R_IA64_LTV32LSB: usize = 117; +pub const R_IA64_LTV64MSB: usize = 118; +pub const R_IA64_LTV64LSB: usize = 119; +pub const R_IA64_PCREL21BI: usize = 121; +pub const R_IA64_PCREL22: usize = 122; +pub const R_IA64_PCREL64I: usize = 123; +pub const R_IA64_IPLTMSB: usize = 128; +pub const R_IA64_IPLTLSB: usize = 129; +pub const R_IA64_COPY: usize = 132; +pub const R_IA64_SUB: usize = 133; +pub const R_IA64_LTOFF22X: usize = 134; +pub const R_IA64_LDXMOV: usize = 135; +pub const R_IA64_TPREL14: usize = 145; +pub const R_IA64_TPREL22: usize = 146; +pub const R_IA64_TPREL64I: usize = 147; +pub const R_IA64_TPREL64MSB: usize = 150; +pub const R_IA64_TPREL64LSB: usize = 151; +pub const R_IA64_LTOFF_TPREL22: usize = 154; +pub const R_IA64_DTPMOD64MSB: usize = 166; +pub const R_IA64_DTPMOD64LSB: usize = 167; +pub const R_IA64_LTOFF_DTPMOD22: usize = 170; +pub const R_IA64_DTPREL14: usize = 177; +pub const R_IA64_DTPREL22: usize = 178; +pub const R_IA64_DTPREL64I: usize = 179; +pub const R_IA64_DTPREL32MSB: usize = 180; +pub const R_IA64_DTPREL32LSB: usize = 181; +pub const R_IA64_DTPREL64MSB: usize = 182; +pub const R_IA64_DTPREL64LSB: usize = 183; +pub const R_IA64_LTOFF_DTPREL22: usize = 186; +pub const EF_SH_MACH_MASK: usize = 31; +pub const EF_SH_UNKNOWN: usize = 0; +pub const EF_SH1: usize = 1; +pub const EF_SH2: usize = 2; +pub const EF_SH3: usize = 3; +pub const EF_SH_DSP: usize = 4; +pub const EF_SH3_DSP: usize = 5; +pub const EF_SH4AL_DSP: usize = 6; +pub const EF_SH3E: usize = 8; +pub const EF_SH4: usize = 9; +pub const EF_SH2E: usize = 11; +pub const EF_SH4A: usize = 12; +pub const EF_SH2A: usize = 13; +pub const EF_SH4_NOFPU: usize = 16; +pub const EF_SH4A_NOFPU: usize = 17; +pub const EF_SH4_NOMMU_NOFPU: usize = 18; +pub const EF_SH2A_NOFPU: usize = 19; +pub const EF_SH3_NOMMU: usize = 20; +pub const EF_SH2A_SH4_NOFPU: usize = 21; +pub const EF_SH2A_SH3_NOFPU: usize = 22; +pub const EF_SH2A_SH4: usize = 23; +pub const EF_SH2A_SH3E: usize = 24; +pub const R_SH_NONE: usize = 0; +pub const R_SH_DIR32: usize = 1; +pub const R_SH_REL32: usize = 2; +pub const R_SH_DIR8WPN: usize = 3; +pub const R_SH_IND12W: usize = 4; +pub const R_SH_DIR8WPL: usize = 5; +pub const R_SH_DIR8WPZ: usize = 6; +pub const R_SH_DIR8BP: usize = 7; +pub const R_SH_DIR8W: usize = 8; +pub const R_SH_DIR8L: usize = 9; +pub const R_SH_SWITCH16: usize = 25; +pub const R_SH_SWITCH32: usize = 26; +pub const R_SH_USES: usize = 27; +pub const R_SH_COUNT: usize = 28; +pub const R_SH_ALIGN: usize = 29; +pub const R_SH_CODE: usize = 30; +pub const R_SH_DATA: usize = 31; +pub const R_SH_LABEL: usize = 32; +pub const R_SH_SWITCH8: usize = 33; +pub const R_SH_GNU_VTINHERIT: usize = 34; +pub const R_SH_GNU_VTENTRY: usize = 35; +pub const R_SH_TLS_GD_32: usize = 144; +pub const R_SH_TLS_LD_32: usize = 145; +pub const R_SH_TLS_LDO_32: usize = 146; +pub const R_SH_TLS_IE_32: usize = 147; +pub const R_SH_TLS_LE_32: usize = 148; +pub const R_SH_TLS_DTPMOD32: usize = 149; +pub const R_SH_TLS_DTPOFF32: usize = 150; +pub const R_SH_TLS_TPOFF32: usize = 151; +pub const R_SH_GOT32: usize = 160; +pub const R_SH_PLT32: usize = 161; +pub const R_SH_COPY: usize = 162; +pub const R_SH_GLOB_DAT: usize = 163; +pub const R_SH_JMP_SLOT: usize = 164; +pub const R_SH_RELATIVE: usize = 165; +pub const R_SH_GOTOFF: usize = 166; +pub const R_SH_GOTPC: usize = 167; +pub const R_SH_NUM: usize = 256; +pub const EF_S390_HIGH_GPRS: usize = 1; +pub const R_390_NONE: usize = 0; +pub const R_390_8: usize = 1; +pub const R_390_12: usize = 2; +pub const R_390_16: usize = 3; +pub const R_390_32: usize = 4; +pub const R_390_PC32: usize = 5; +pub const R_390_GOT12: usize = 6; +pub const R_390_GOT32: usize = 7; +pub const R_390_PLT32: usize = 8; +pub const R_390_COPY: usize = 9; +pub const R_390_GLOB_DAT: usize = 10; +pub const R_390_JMP_SLOT: usize = 11; +pub const R_390_RELATIVE: usize = 12; +pub const R_390_GOTOFF32: usize = 13; +pub const R_390_GOTPC: usize = 14; +pub const R_390_GOT16: usize = 15; +pub const R_390_PC16: usize = 16; +pub const R_390_PC16DBL: usize = 17; +pub const R_390_PLT16DBL: usize = 18; +pub const R_390_PC32DBL: usize = 19; +pub const R_390_PLT32DBL: usize = 20; +pub const R_390_GOTPCDBL: usize = 21; +pub const R_390_64: usize = 22; +pub const R_390_PC64: usize = 23; +pub const R_390_GOT64: usize = 24; +pub const R_390_PLT64: usize = 25; +pub const R_390_GOTENT: usize = 26; +pub const R_390_GOTOFF16: usize = 27; +pub const R_390_GOTOFF64: usize = 28; +pub const R_390_GOTPLT12: usize = 29; +pub const R_390_GOTPLT16: usize = 30; +pub const R_390_GOTPLT32: usize = 31; +pub const R_390_GOTPLT64: usize = 32; +pub const R_390_GOTPLTENT: usize = 33; +pub const R_390_PLTOFF16: usize = 34; +pub const R_390_PLTOFF32: usize = 35; +pub const R_390_PLTOFF64: usize = 36; +pub const R_390_TLS_LOAD: usize = 37; +pub const R_390_TLS_GDCALL: usize = 38; +pub const R_390_TLS_LDCALL: usize = 39; +pub const R_390_TLS_GD32: usize = 40; +pub const R_390_TLS_GD64: usize = 41; +pub const R_390_TLS_GOTIE12: usize = 42; +pub const R_390_TLS_GOTIE32: usize = 43; +pub const R_390_TLS_GOTIE64: usize = 44; +pub const R_390_TLS_LDM32: usize = 45; +pub const R_390_TLS_LDM64: usize = 46; +pub const R_390_TLS_IE32: usize = 47; +pub const R_390_TLS_IE64: usize = 48; +pub const R_390_TLS_IEENT: usize = 49; +pub const R_390_TLS_LE32: usize = 50; +pub const R_390_TLS_LE64: usize = 51; +pub const R_390_TLS_LDO32: usize = 52; +pub const R_390_TLS_LDO64: usize = 53; +pub const R_390_TLS_DTPMOD: usize = 54; +pub const R_390_TLS_DTPOFF: usize = 55; +pub const R_390_TLS_TPOFF: usize = 56; +pub const R_390_20: usize = 57; +pub const R_390_GOT20: usize = 58; +pub const R_390_GOTPLT20: usize = 59; +pub const R_390_TLS_GOTIE20: usize = 60; +pub const R_390_IRELATIVE: usize = 61; +pub const R_390_NUM: usize = 62; +pub const R_CRIS_NONE: usize = 0; +pub const R_CRIS_8: usize = 1; +pub const R_CRIS_16: usize = 2; +pub const R_CRIS_32: usize = 3; +pub const R_CRIS_8_PCREL: usize = 4; +pub const R_CRIS_16_PCREL: usize = 5; +pub const R_CRIS_32_PCREL: usize = 6; +pub const R_CRIS_GNU_VTINHERIT: usize = 7; +pub const R_CRIS_GNU_VTENTRY: usize = 8; +pub const R_CRIS_COPY: usize = 9; +pub const R_CRIS_GLOB_DAT: usize = 10; +pub const R_CRIS_JUMP_SLOT: usize = 11; +pub const R_CRIS_RELATIVE: usize = 12; +pub const R_CRIS_16_GOT: usize = 13; +pub const R_CRIS_32_GOT: usize = 14; +pub const R_CRIS_16_GOTPLT: usize = 15; +pub const R_CRIS_32_GOTPLT: usize = 16; +pub const R_CRIS_32_GOTREL: usize = 17; +pub const R_CRIS_32_PLT_GOTREL: usize = 18; +pub const R_CRIS_32_PLT_PCREL: usize = 19; +pub const R_CRIS_NUM: usize = 20; +pub const R_X86_64_NONE: usize = 0; +pub const R_X86_64_64: usize = 1; +pub const R_X86_64_PC32: usize = 2; +pub const R_X86_64_GOT32: usize = 3; +pub const R_X86_64_PLT32: usize = 4; +pub const R_X86_64_COPY: usize = 5; +pub const R_X86_64_GLOB_DAT: usize = 6; +pub const R_X86_64_JUMP_SLOT: usize = 7; +pub const R_X86_64_RELATIVE: usize = 8; +pub const R_X86_64_GOTPCREL: usize = 9; +pub const R_X86_64_32: usize = 10; +pub const R_X86_64_32S: usize = 11; +pub const R_X86_64_16: usize = 12; +pub const R_X86_64_PC16: usize = 13; +pub const R_X86_64_8: usize = 14; +pub const R_X86_64_PC8: usize = 15; +pub const R_X86_64_DTPMOD64: usize = 16; +pub const R_X86_64_DTPOFF64: usize = 17; +pub const R_X86_64_TPOFF64: usize = 18; +pub const R_X86_64_TLSGD: usize = 19; +pub const R_X86_64_TLSLD: usize = 20; +pub const R_X86_64_DTPOFF32: usize = 21; +pub const R_X86_64_GOTTPOFF: usize = 22; +pub const R_X86_64_TPOFF32: usize = 23; +pub const R_X86_64_PC64: usize = 24; +pub const R_X86_64_GOTOFF64: usize = 25; +pub const R_X86_64_GOTPC32: usize = 26; +pub const R_X86_64_GOT64: usize = 27; +pub const R_X86_64_GOTPCREL64: usize = 28; +pub const R_X86_64_GOTPC64: usize = 29; +pub const R_X86_64_GOTPLT64: usize = 30; +pub const R_X86_64_PLTOFF64: usize = 31; +pub const R_X86_64_SIZE32: usize = 32; +pub const R_X86_64_SIZE64: usize = 33; +pub const R_X86_64_GOTPC32_TLSDESC: usize = 34; +pub const R_X86_64_TLSDESC_CALL: usize = 35; +pub const R_X86_64_TLSDESC: usize = 36; +pub const R_X86_64_IRELATIVE: usize = 37; +pub const R_X86_64_RELATIVE64: usize = 38; +pub const R_X86_64_NUM: usize = 39; +pub const R_MN10300_NONE: usize = 0; +pub const R_MN10300_32: usize = 1; +pub const R_MN10300_16: usize = 2; +pub const R_MN10300_8: usize = 3; +pub const R_MN10300_PCREL32: usize = 4; +pub const R_MN10300_PCREL16: usize = 5; +pub const R_MN10300_PCREL8: usize = 6; +pub const R_MN10300_GNU_VTINHERIT: usize = 7; +pub const R_MN10300_GNU_VTENTRY: usize = 8; +pub const R_MN10300_24: usize = 9; +pub const R_MN10300_GOTPC32: usize = 10; +pub const R_MN10300_GOTPC16: usize = 11; +pub const R_MN10300_GOTOFF32: usize = 12; +pub const R_MN10300_GOTOFF24: usize = 13; +pub const R_MN10300_GOTOFF16: usize = 14; +pub const R_MN10300_PLT32: usize = 15; +pub const R_MN10300_PLT16: usize = 16; +pub const R_MN10300_GOT32: usize = 17; +pub const R_MN10300_GOT24: usize = 18; +pub const R_MN10300_GOT16: usize = 19; +pub const R_MN10300_COPY: usize = 20; +pub const R_MN10300_GLOB_DAT: usize = 21; +pub const R_MN10300_JMP_SLOT: usize = 22; +pub const R_MN10300_RELATIVE: usize = 23; +pub const R_MN10300_TLS_GD: usize = 24; +pub const R_MN10300_TLS_LD: usize = 25; +pub const R_MN10300_TLS_LDO: usize = 26; +pub const R_MN10300_TLS_GOTIE: usize = 27; +pub const R_MN10300_TLS_IE: usize = 28; +pub const R_MN10300_TLS_LE: usize = 29; +pub const R_MN10300_TLS_DTPMOD: usize = 30; +pub const R_MN10300_TLS_DTPOFF: usize = 31; +pub const R_MN10300_TLS_TPOFF: usize = 32; +pub const R_MN10300_SYM_DIFF: usize = 33; +pub const R_MN10300_ALIGN: usize = 34; +pub const R_MN10300_NUM: usize = 35; +pub const R_M32R_NONE: usize = 0; +pub const R_M32R_16: usize = 1; +pub const R_M32R_32: usize = 2; +pub const R_M32R_24: usize = 3; +pub const R_M32R_10_PCREL: usize = 4; +pub const R_M32R_18_PCREL: usize = 5; +pub const R_M32R_26_PCREL: usize = 6; +pub const R_M32R_HI16_ULO: usize = 7; +pub const R_M32R_HI16_SLO: usize = 8; +pub const R_M32R_LO16: usize = 9; +pub const R_M32R_SDA16: usize = 10; +pub const R_M32R_GNU_VTINHERIT: usize = 11; +pub const R_M32R_GNU_VTENTRY: usize = 12; +pub const R_M32R_16_RELA: usize = 33; +pub const R_M32R_32_RELA: usize = 34; +pub const R_M32R_24_RELA: usize = 35; +pub const R_M32R_10_PCREL_RELA: usize = 36; +pub const R_M32R_18_PCREL_RELA: usize = 37; +pub const R_M32R_26_PCREL_RELA: usize = 38; +pub const R_M32R_HI16_ULO_RELA: usize = 39; +pub const R_M32R_HI16_SLO_RELA: usize = 40; +pub const R_M32R_LO16_RELA: usize = 41; +pub const R_M32R_SDA16_RELA: usize = 42; +pub const R_M32R_RELA_GNU_VTINHERIT: usize = 43; +pub const R_M32R_RELA_GNU_VTENTRY: usize = 44; +pub const R_M32R_REL32: usize = 45; +pub const R_M32R_GOT24: usize = 48; +pub const R_M32R_26_PLTREL: usize = 49; +pub const R_M32R_COPY: usize = 50; +pub const R_M32R_GLOB_DAT: usize = 51; +pub const R_M32R_JMP_SLOT: usize = 52; +pub const R_M32R_RELATIVE: usize = 53; +pub const R_M32R_GOTOFF: usize = 54; +pub const R_M32R_GOTPC24: usize = 55; +pub const R_M32R_GOT16_HI_ULO: usize = 56; +pub const R_M32R_GOT16_HI_SLO: usize = 57; +pub const R_M32R_GOT16_LO: usize = 58; +pub const R_M32R_GOTPC_HI_ULO: usize = 59; +pub const R_M32R_GOTPC_HI_SLO: usize = 60; +pub const R_M32R_GOTPC_LO: usize = 61; +pub const R_M32R_GOTOFF_HI_ULO: usize = 62; +pub const R_M32R_GOTOFF_HI_SLO: usize = 63; +pub const R_M32R_GOTOFF_LO: usize = 64; +pub const R_M32R_NUM: usize = 256; +pub const R_MICROBLAZE_NONE: usize = 0; +pub const R_MICROBLAZE_32: usize = 1; +pub const R_MICROBLAZE_32_PCREL: usize = 2; +pub const R_MICROBLAZE_64_PCREL: usize = 3; +pub const R_MICROBLAZE_32_PCREL_LO: usize = 4; +pub const R_MICROBLAZE_64: usize = 5; +pub const R_MICROBLAZE_32_LO: usize = 6; +pub const R_MICROBLAZE_SRO32: usize = 7; +pub const R_MICROBLAZE_SRW32: usize = 8; +pub const R_MICROBLAZE_64_NONE: usize = 9; +pub const R_MICROBLAZE_32_SYM_OP_SYM: usize = 10; +pub const R_MICROBLAZE_GNU_VTINHERIT: usize = 11; +pub const R_MICROBLAZE_GNU_VTENTRY: usize = 12; +pub const R_MICROBLAZE_GOTPC_64: usize = 13; +pub const R_MICROBLAZE_GOT_64: usize = 14; +pub const R_MICROBLAZE_PLT_64: usize = 15; +pub const R_MICROBLAZE_REL: usize = 16; +pub const R_MICROBLAZE_JUMP_SLOT: usize = 17; +pub const R_MICROBLAZE_GLOB_DAT: usize = 18; +pub const R_MICROBLAZE_GOTOFF_64: usize = 19; +pub const R_MICROBLAZE_GOTOFF_32: usize = 20; +pub const R_MICROBLAZE_COPY: usize = 21; +pub const R_MICROBLAZE_TLS: usize = 22; +pub const R_MICROBLAZE_TLSGD: usize = 23; +pub const R_MICROBLAZE_TLSLD: usize = 24; +pub const R_MICROBLAZE_TLSDTPMOD32: usize = 25; +pub const R_MICROBLAZE_TLSDTPREL32: usize = 26; +pub const R_MICROBLAZE_TLSDTPREL64: usize = 27; +pub const R_MICROBLAZE_TLSGOTTPREL32: usize = 28; +pub const R_MICROBLAZE_TLSTPREL32: usize = 29; +pub const R_TILEPRO_NONE: usize = 0; +pub const R_TILEPRO_32: usize = 1; +pub const R_TILEPRO_16: usize = 2; +pub const R_TILEPRO_8: usize = 3; +pub const R_TILEPRO_32_PCREL: usize = 4; +pub const R_TILEPRO_16_PCREL: usize = 5; +pub const R_TILEPRO_8_PCREL: usize = 6; +pub const R_TILEPRO_LO16: usize = 7; +pub const R_TILEPRO_HI16: usize = 8; +pub const R_TILEPRO_HA16: usize = 9; +pub const R_TILEPRO_COPY: usize = 10; +pub const R_TILEPRO_GLOB_DAT: usize = 11; +pub const R_TILEPRO_JMP_SLOT: usize = 12; +pub const R_TILEPRO_RELATIVE: usize = 13; +pub const R_TILEPRO_BROFF_X1: usize = 14; +pub const R_TILEPRO_JOFFLONG_X1: usize = 15; +pub const R_TILEPRO_JOFFLONG_X1_PLT: usize = 16; +pub const R_TILEPRO_IMM8_X0: usize = 17; +pub const R_TILEPRO_IMM8_Y0: usize = 18; +pub const R_TILEPRO_IMM8_X1: usize = 19; +pub const R_TILEPRO_IMM8_Y1: usize = 20; +pub const R_TILEPRO_MT_IMM15_X1: usize = 21; +pub const R_TILEPRO_MF_IMM15_X1: usize = 22; +pub const R_TILEPRO_IMM16_X0: usize = 23; +pub const R_TILEPRO_IMM16_X1: usize = 24; +pub const R_TILEPRO_IMM16_X0_LO: usize = 25; +pub const R_TILEPRO_IMM16_X1_LO: usize = 26; +pub const R_TILEPRO_IMM16_X0_HI: usize = 27; +pub const R_TILEPRO_IMM16_X1_HI: usize = 28; +pub const R_TILEPRO_IMM16_X0_HA: usize = 29; +pub const R_TILEPRO_IMM16_X1_HA: usize = 30; +pub const R_TILEPRO_IMM16_X0_PCREL: usize = 31; +pub const R_TILEPRO_IMM16_X1_PCREL: usize = 32; +pub const R_TILEPRO_IMM16_X0_LO_PCREL: usize = 33; +pub const R_TILEPRO_IMM16_X1_LO_PCREL: usize = 34; +pub const R_TILEPRO_IMM16_X0_HI_PCREL: usize = 35; +pub const R_TILEPRO_IMM16_X1_HI_PCREL: usize = 36; +pub const R_TILEPRO_IMM16_X0_HA_PCREL: usize = 37; +pub const R_TILEPRO_IMM16_X1_HA_PCREL: usize = 38; +pub const R_TILEPRO_IMM16_X0_GOT: usize = 39; +pub const R_TILEPRO_IMM16_X1_GOT: usize = 40; +pub const R_TILEPRO_IMM16_X0_GOT_LO: usize = 41; +pub const R_TILEPRO_IMM16_X1_GOT_LO: usize = 42; +pub const R_TILEPRO_IMM16_X0_GOT_HI: usize = 43; +pub const R_TILEPRO_IMM16_X1_GOT_HI: usize = 44; +pub const R_TILEPRO_IMM16_X0_GOT_HA: usize = 45; +pub const R_TILEPRO_IMM16_X1_GOT_HA: usize = 46; +pub const R_TILEPRO_MMSTART_X0: usize = 47; +pub const R_TILEPRO_MMEND_X0: usize = 48; +pub const R_TILEPRO_MMSTART_X1: usize = 49; +pub const R_TILEPRO_MMEND_X1: usize = 50; +pub const R_TILEPRO_SHAMT_X0: usize = 51; +pub const R_TILEPRO_SHAMT_X1: usize = 52; +pub const R_TILEPRO_SHAMT_Y0: usize = 53; +pub const R_TILEPRO_SHAMT_Y1: usize = 54; +pub const R_TILEPRO_DEST_IMM8_X1: usize = 55; +pub const R_TILEPRO_TLS_GD_CALL: usize = 60; +pub const R_TILEPRO_IMM8_X0_TLS_GD_ADD: usize = 61; +pub const R_TILEPRO_IMM8_X1_TLS_GD_ADD: usize = 62; +pub const R_TILEPRO_IMM8_Y0_TLS_GD_ADD: usize = 63; +pub const R_TILEPRO_IMM8_Y1_TLS_GD_ADD: usize = 64; +pub const R_TILEPRO_TLS_IE_LOAD: usize = 65; +pub const R_TILEPRO_IMM16_X0_TLS_GD: usize = 66; +pub const R_TILEPRO_IMM16_X1_TLS_GD: usize = 67; +pub const R_TILEPRO_IMM16_X0_TLS_GD_LO: usize = 68; +pub const R_TILEPRO_IMM16_X1_TLS_GD_LO: usize = 69; +pub const R_TILEPRO_IMM16_X0_TLS_GD_HI: usize = 70; +pub const R_TILEPRO_IMM16_X1_TLS_GD_HI: usize = 71; +pub const R_TILEPRO_IMM16_X0_TLS_GD_HA: usize = 72; +pub const R_TILEPRO_IMM16_X1_TLS_GD_HA: usize = 73; +pub const R_TILEPRO_IMM16_X0_TLS_IE: usize = 74; +pub const R_TILEPRO_IMM16_X1_TLS_IE: usize = 75; +pub const R_TILEPRO_IMM16_X0_TLS_IE_LO: usize = 76; +pub const R_TILEPRO_IMM16_X1_TLS_IE_LO: usize = 77; +pub const R_TILEPRO_IMM16_X0_TLS_IE_HI: usize = 78; +pub const R_TILEPRO_IMM16_X1_TLS_IE_HI: usize = 79; +pub const R_TILEPRO_IMM16_X0_TLS_IE_HA: usize = 80; +pub const R_TILEPRO_IMM16_X1_TLS_IE_HA: usize = 81; +pub const R_TILEPRO_TLS_DTPMOD32: usize = 82; +pub const R_TILEPRO_TLS_DTPOFF32: usize = 83; +pub const R_TILEPRO_TLS_TPOFF32: usize = 84; +pub const R_TILEPRO_IMM16_X0_TLS_LE: usize = 85; +pub const R_TILEPRO_IMM16_X1_TLS_LE: usize = 86; +pub const R_TILEPRO_IMM16_X0_TLS_LE_LO: usize = 87; +pub const R_TILEPRO_IMM16_X1_TLS_LE_LO: usize = 88; +pub const R_TILEPRO_IMM16_X0_TLS_LE_HI: usize = 89; +pub const R_TILEPRO_IMM16_X1_TLS_LE_HI: usize = 90; +pub const R_TILEPRO_IMM16_X0_TLS_LE_HA: usize = 91; +pub const R_TILEPRO_IMM16_X1_TLS_LE_HA: usize = 92; +pub const R_TILEPRO_GNU_VTINHERIT: usize = 128; +pub const R_TILEPRO_GNU_VTENTRY: usize = 129; +pub const R_TILEPRO_NUM: usize = 130; +pub const R_TILEGX_NONE: usize = 0; +pub const R_TILEGX_64: usize = 1; +pub const R_TILEGX_32: usize = 2; +pub const R_TILEGX_16: usize = 3; +pub const R_TILEGX_8: usize = 4; +pub const R_TILEGX_64_PCREL: usize = 5; +pub const R_TILEGX_32_PCREL: usize = 6; +pub const R_TILEGX_16_PCREL: usize = 7; +pub const R_TILEGX_8_PCREL: usize = 8; +pub const R_TILEGX_HW0: usize = 9; +pub const R_TILEGX_HW1: usize = 10; +pub const R_TILEGX_HW2: usize = 11; +pub const R_TILEGX_HW3: usize = 12; +pub const R_TILEGX_HW0_LAST: usize = 13; +pub const R_TILEGX_HW1_LAST: usize = 14; +pub const R_TILEGX_HW2_LAST: usize = 15; +pub const R_TILEGX_COPY: usize = 16; +pub const R_TILEGX_GLOB_DAT: usize = 17; +pub const R_TILEGX_JMP_SLOT: usize = 18; +pub const R_TILEGX_RELATIVE: usize = 19; +pub const R_TILEGX_BROFF_X1: usize = 20; +pub const R_TILEGX_JUMPOFF_X1: usize = 21; +pub const R_TILEGX_JUMPOFF_X1_PLT: usize = 22; +pub const R_TILEGX_IMM8_X0: usize = 23; +pub const R_TILEGX_IMM8_Y0: usize = 24; +pub const R_TILEGX_IMM8_X1: usize = 25; +pub const R_TILEGX_IMM8_Y1: usize = 26; +pub const R_TILEGX_DEST_IMM8_X1: usize = 27; +pub const R_TILEGX_MT_IMM14_X1: usize = 28; +pub const R_TILEGX_MF_IMM14_X1: usize = 29; +pub const R_TILEGX_MMSTART_X0: usize = 30; +pub const R_TILEGX_MMEND_X0: usize = 31; +pub const R_TILEGX_SHAMT_X0: usize = 32; +pub const R_TILEGX_SHAMT_X1: usize = 33; +pub const R_TILEGX_SHAMT_Y0: usize = 34; +pub const R_TILEGX_SHAMT_Y1: usize = 35; +pub const R_TILEGX_IMM16_X0_HW0: usize = 36; +pub const R_TILEGX_IMM16_X1_HW0: usize = 37; +pub const R_TILEGX_IMM16_X0_HW1: usize = 38; +pub const R_TILEGX_IMM16_X1_HW1: usize = 39; +pub const R_TILEGX_IMM16_X0_HW2: usize = 40; +pub const R_TILEGX_IMM16_X1_HW2: usize = 41; +pub const R_TILEGX_IMM16_X0_HW3: usize = 42; +pub const R_TILEGX_IMM16_X1_HW3: usize = 43; +pub const R_TILEGX_IMM16_X0_HW0_LAST: usize = 44; +pub const R_TILEGX_IMM16_X1_HW0_LAST: usize = 45; +pub const R_TILEGX_IMM16_X0_HW1_LAST: usize = 46; +pub const R_TILEGX_IMM16_X1_HW1_LAST: usize = 47; +pub const R_TILEGX_IMM16_X0_HW2_LAST: usize = 48; +pub const R_TILEGX_IMM16_X1_HW2_LAST: usize = 49; +pub const R_TILEGX_IMM16_X0_HW0_PCREL: usize = 50; +pub const R_TILEGX_IMM16_X1_HW0_PCREL: usize = 51; +pub const R_TILEGX_IMM16_X0_HW1_PCREL: usize = 52; +pub const R_TILEGX_IMM16_X1_HW1_PCREL: usize = 53; +pub const R_TILEGX_IMM16_X0_HW2_PCREL: usize = 54; +pub const R_TILEGX_IMM16_X1_HW2_PCREL: usize = 55; +pub const R_TILEGX_IMM16_X0_HW3_PCREL: usize = 56; +pub const R_TILEGX_IMM16_X1_HW3_PCREL: usize = 57; +pub const R_TILEGX_IMM16_X0_HW0_LAST_PCREL: usize = 58; +pub const R_TILEGX_IMM16_X1_HW0_LAST_PCREL: usize = 59; +pub const R_TILEGX_IMM16_X0_HW1_LAST_PCREL: usize = 60; +pub const R_TILEGX_IMM16_X1_HW1_LAST_PCREL: usize = 61; +pub const R_TILEGX_IMM16_X0_HW2_LAST_PCREL: usize = 62; +pub const R_TILEGX_IMM16_X1_HW2_LAST_PCREL: usize = 63; +pub const R_TILEGX_IMM16_X0_HW0_GOT: usize = 64; +pub const R_TILEGX_IMM16_X1_HW0_GOT: usize = 65; +pub const R_TILEGX_IMM16_X0_HW0_PLT_PCREL: usize = 66; +pub const R_TILEGX_IMM16_X1_HW0_PLT_PCREL: usize = 67; +pub const R_TILEGX_IMM16_X0_HW1_PLT_PCREL: usize = 68; +pub const R_TILEGX_IMM16_X1_HW1_PLT_PCREL: usize = 69; +pub const R_TILEGX_IMM16_X0_HW2_PLT_PCREL: usize = 70; +pub const R_TILEGX_IMM16_X1_HW2_PLT_PCREL: usize = 71; +pub const R_TILEGX_IMM16_X0_HW0_LAST_GOT: usize = 72; +pub const R_TILEGX_IMM16_X1_HW0_LAST_GOT: usize = 73; +pub const R_TILEGX_IMM16_X0_HW1_LAST_GOT: usize = 74; +pub const R_TILEGX_IMM16_X1_HW1_LAST_GOT: usize = 75; +pub const R_TILEGX_IMM16_X0_HW3_PLT_PCREL: usize = 76; +pub const R_TILEGX_IMM16_X1_HW3_PLT_PCREL: usize = 77; +pub const R_TILEGX_IMM16_X0_HW0_TLS_GD: usize = 78; +pub const R_TILEGX_IMM16_X1_HW0_TLS_GD: usize = 79; +pub const R_TILEGX_IMM16_X0_HW0_TLS_LE: usize = 80; +pub const R_TILEGX_IMM16_X1_HW0_TLS_LE: usize = 81; +pub const R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE: usize = 82; +pub const R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE: usize = 83; +pub const R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE: usize = 84; +pub const R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE: usize = 85; +pub const R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD: usize = 86; +pub const R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD: usize = 87; +pub const R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD: usize = 88; +pub const R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD: usize = 89; +pub const R_TILEGX_IMM16_X0_HW0_TLS_IE: usize = 92; +pub const R_TILEGX_IMM16_X1_HW0_TLS_IE: usize = 93; +pub const R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL: usize = 94; +pub const R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL: usize = 95; +pub const R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL: usize = 96; +pub const R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL: usize = 97; +pub const R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL: usize = 98; +pub const R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL: usize = 99; +pub const R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE: usize = 100; +pub const R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE: usize = 101; +pub const R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE: usize = 102; +pub const R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE: usize = 103; +pub const R_TILEGX_TLS_DTPMOD64: usize = 106; +pub const R_TILEGX_TLS_DTPOFF64: usize = 107; +pub const R_TILEGX_TLS_TPOFF64: usize = 108; +pub const R_TILEGX_TLS_DTPMOD32: usize = 109; +pub const R_TILEGX_TLS_DTPOFF32: usize = 110; +pub const R_TILEGX_TLS_TPOFF32: usize = 111; +pub const R_TILEGX_TLS_GD_CALL: usize = 112; +pub const R_TILEGX_IMM8_X0_TLS_GD_ADD: usize = 113; +pub const R_TILEGX_IMM8_X1_TLS_GD_ADD: usize = 114; +pub const R_TILEGX_IMM8_Y0_TLS_GD_ADD: usize = 115; +pub const R_TILEGX_IMM8_Y1_TLS_GD_ADD: usize = 116; +pub const R_TILEGX_TLS_IE_LOAD: usize = 117; +pub const R_TILEGX_IMM8_X0_TLS_ADD: usize = 118; +pub const R_TILEGX_IMM8_X1_TLS_ADD: usize = 119; +pub const R_TILEGX_IMM8_Y0_TLS_ADD: usize = 120; +pub const R_TILEGX_IMM8_Y1_TLS_ADD: usize = 121; +pub const R_TILEGX_GNU_VTINHERIT: usize = 128; +pub const R_TILEGX_GNU_VTENTRY: usize = 129; +pub const R_TILEGX_NUM: usize = 130; +pub const R_OR1K_NONE: u8 = 0; +pub const R_OR1K_32: u8 = 1; +pub const R_OR1K_16: u8 = 2; +pub const R_OR1K_8: u8 = 3; +pub const R_OR1K_LO_16_IN_INSN: u8 = 4; +pub const R_OR1K_HI_16_IN_INSN: u8 = 5; +pub const R_OR1K_INSN_REL_26: u8 = 6; +pub const R_OR1K_GNU_VTENTRY: u8 = 7; +pub const R_OR1K_GNU_VTINHERIT: u8 = 8; +pub const R_OR1K_32_PCREL: u8 = 9; +pub const R_OR1K_16_PCREL: u8 = 10; +pub const R_OR1K_8_PCREL: u8 = 11; +pub const R_OR1K_GOTPC_HI16: u8 = 12; +pub const R_OR1K_GOTPC_LO16: u8 = 13; +pub const R_OR1K_GOT16: u8 = 14; +pub const R_OR1K_PLT26: u8 = 15; +pub const R_OR1K_GOTOFF_HI16: u8 = 16; +pub const R_OR1K_GOTOFF_LO16: u8 = 17; +pub const R_OR1K_COPY: u8 = 18; +pub const R_OR1K_GLOB_DAT: u8 = 19; +pub const R_OR1K_JMP_SLOT: u8 = 20; +pub const R_OR1K_RELATIVE: u8 = 21; +pub const R_OR1K_TLS_GD_HI16: u8 = 22; +pub const R_OR1K_TLS_GD_LO16: u8 = 23; +pub const R_OR1K_TLS_LDM_HI16: u8 = 24; +pub const R_OR1K_TLS_LDM_LO16: u8 = 25; +pub const R_OR1K_TLS_LDO_HI16: u8 = 26; +pub const R_OR1K_TLS_LDO_LO16: u8 = 27; +pub const R_OR1K_TLS_IE_HI16: u8 = 28; +pub const R_OR1K_TLS_IE_LO16: u8 = 29; +pub const R_OR1K_TLS_LE_HI16: u8 = 30; +pub const R_OR1K_TLS_LE_LO16: u8 = 31; +pub const R_OR1K_TLS_TPOFF: u8 = 32; +pub const R_OR1K_TLS_DTPOFF: u8 = 33; +pub const R_OR1K_TLS_DTPMOD: u8 = 34; +pub const R_OR1K_NUM: u8 = 35; + +pub type Elf32_Half = u16; +pub type Elf64_Half = u16; +pub type Elf32_Word = u32; +pub type Elf32_Sword = i32; +pub type Elf64_Word = u32; +pub type Elf64_Sword = i32; +pub type Elf32_Xword = u64; +pub type Elf32_Sxword = i64; +pub type Elf64_Xword = u64; +pub type Elf64_Sxword = i64; +pub type Elf32_Addr = u32; +pub type Elf64_Addr = u64; +pub type Elf32_Off = u32; +pub type Elf64_Off = u64; +pub type Elf32_Section = u16; +pub type Elf64_Section = u16; +pub type Elf32_Versym = Elf32_Half; +pub type Elf64_Versym = Elf64_Half; + +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Ehdr { + pub e_ident: [u8; 16usize], + pub e_type: Elf32_Half, + pub e_machine: Elf32_Half, + pub e_version: Elf32_Word, + pub e_entry: Elf32_Addr, + pub e_phoff: Elf32_Off, + pub e_shoff: Elf32_Off, + pub e_flags: Elf32_Word, + pub e_ehsize: Elf32_Half, + pub e_phentsize: Elf32_Half, + pub e_phnum: Elf32_Half, + pub e_shentsize: Elf32_Half, + pub e_shnum: Elf32_Half, + pub e_shstrndx: Elf32_Half, +} +impl Clone for Elf32_Ehdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Ehdr { + pub e_ident: [u8; 16usize], + pub e_type: Elf64_Half, + pub e_machine: Elf64_Half, + pub e_version: Elf64_Word, + pub e_entry: Elf64_Addr, + pub e_phoff: Elf64_Off, + pub e_shoff: Elf64_Off, + pub e_flags: Elf64_Word, + pub e_ehsize: Elf64_Half, + pub e_phentsize: Elf64_Half, + pub e_phnum: Elf64_Half, + pub e_shentsize: Elf64_Half, + pub e_shnum: Elf64_Half, + pub e_shstrndx: Elf64_Half, +} +impl Clone for Elf64_Ehdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Shdr { + pub sh_name: Elf32_Word, + pub sh_type: Elf32_Word, + pub sh_flags: Elf32_Word, + pub sh_addr: Elf32_Addr, + pub sh_offset: Elf32_Off, + pub sh_size: Elf32_Word, + pub sh_link: Elf32_Word, + pub sh_info: Elf32_Word, + pub sh_addralign: Elf32_Word, + pub sh_entsize: Elf32_Word, +} +impl Clone for Elf32_Shdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Shdr { + pub sh_name: Elf64_Word, + pub sh_type: Elf64_Word, + pub sh_flags: Elf64_Xword, + pub sh_addr: Elf64_Addr, + pub sh_offset: Elf64_Off, + pub sh_size: Elf64_Xword, + pub sh_link: Elf64_Word, + pub sh_info: Elf64_Word, + pub sh_addralign: Elf64_Xword, + pub sh_entsize: Elf64_Xword, +} +impl Clone for Elf64_Shdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Sym { + pub st_name: Elf32_Word, + pub st_value: Elf32_Addr, + pub st_size: Elf32_Word, + pub st_info: u8, + pub st_other: u8, + pub st_shndx: Elf32_Section, +} +impl Clone for Elf32_Sym { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Sym { + pub st_name: Elf64_Word, + pub st_info: u8, + pub st_other: u8, + pub st_shndx: Elf64_Section, + pub st_value: Elf64_Addr, + pub st_size: Elf64_Xword, +} +impl Clone for Elf64_Sym { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Syminfo { + pub si_boundto: Elf32_Half, + pub si_flags: Elf32_Half, +} +impl Clone for Elf32_Syminfo { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Syminfo { + pub si_boundto: Elf64_Half, + pub si_flags: Elf64_Half, +} +impl Clone for Elf64_Syminfo { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Rel { + pub r_offset: Elf32_Addr, + pub r_info: Elf32_Word, +} +impl Clone for Elf32_Rel { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Rel { + pub r_offset: Elf64_Addr, + pub r_info: Elf64_Xword, +} +impl Clone for Elf64_Rel { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Rela { + pub r_offset: Elf32_Addr, + pub r_info: Elf32_Word, + pub r_addend: Elf32_Sword, +} +impl Clone for Elf32_Rela { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Rela { + pub r_offset: Elf64_Addr, + pub r_info: Elf64_Xword, + pub r_addend: Elf64_Sxword, +} +impl Clone for Elf64_Rela { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Phdr { + pub p_type: Elf32_Word, + pub p_offset: Elf32_Off, + pub p_vaddr: Elf32_Addr, + pub p_paddr: Elf32_Addr, + pub p_filesz: Elf32_Word, + pub p_memsz: Elf32_Word, + pub p_flags: Elf32_Word, + pub p_align: Elf32_Word, +} +impl Clone for Elf32_Phdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Phdr { + pub p_type: Elf64_Word, + pub p_flags: Elf64_Word, + pub p_offset: Elf64_Off, + pub p_vaddr: Elf64_Addr, + pub p_paddr: Elf64_Addr, + pub p_filesz: Elf64_Xword, + pub p_memsz: Elf64_Xword, + pub p_align: Elf64_Xword, +} +impl Clone for Elf64_Phdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Copy)] +pub struct Elf32_Dyn { + pub d_tag: Elf32_Sword, + pub d_un: Elf32_Dyn__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy)] +pub union Elf32_Dyn__bindgen_ty_1 { + pub d_val: Elf32_Word, + pub d_ptr: Elf32_Addr, +} +impl Clone for Elf32_Dyn__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +impl Clone for Elf32_Dyn { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Copy)] +pub struct Elf64_Dyn { + pub d_tag: Elf64_Sxword, + pub d_un: Elf64_Dyn__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy)] +pub union Elf64_Dyn__bindgen_ty_1 { + pub d_val: Elf64_Xword, + pub d_ptr: Elf64_Addr, +} +impl Clone for Elf64_Dyn__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +impl Clone for Elf64_Dyn { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Verdef { + pub vd_version: Elf32_Half, + pub vd_flags: Elf32_Half, + pub vd_ndx: Elf32_Half, + pub vd_cnt: Elf32_Half, + pub vd_hash: Elf32_Word, + pub vd_aux: Elf32_Word, + pub vd_next: Elf32_Word, +} +impl Clone for Elf32_Verdef { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Verdef { + pub vd_version: Elf64_Half, + pub vd_flags: Elf64_Half, + pub vd_ndx: Elf64_Half, + pub vd_cnt: Elf64_Half, + pub vd_hash: Elf64_Word, + pub vd_aux: Elf64_Word, + pub vd_next: Elf64_Word, +} +impl Clone for Elf64_Verdef { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Verdaux { + pub vda_name: Elf32_Word, + pub vda_next: Elf32_Word, +} +impl Clone for Elf32_Verdaux { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Verdaux { + pub vda_name: Elf64_Word, + pub vda_next: Elf64_Word, +} +impl Clone for Elf64_Verdaux { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Verneed { + pub vn_version: Elf32_Half, + pub vn_cnt: Elf32_Half, + pub vn_file: Elf32_Word, + pub vn_aux: Elf32_Word, + pub vn_next: Elf32_Word, +} +impl Clone for Elf32_Verneed { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Verneed { + pub vn_version: Elf64_Half, + pub vn_cnt: Elf64_Half, + pub vn_file: Elf64_Word, + pub vn_aux: Elf64_Word, + pub vn_next: Elf64_Word, +} +impl Clone for Elf64_Verneed { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Vernaux { + pub vna_hash: Elf32_Word, + pub vna_flags: Elf32_Half, + pub vna_other: Elf32_Half, + pub vna_name: Elf32_Word, + pub vna_next: Elf32_Word, +} +impl Clone for Elf32_Vernaux { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Vernaux { + pub vna_hash: Elf64_Word, + pub vna_flags: Elf64_Half, + pub vna_other: Elf64_Half, + pub vna_name: Elf64_Word, + pub vna_next: Elf64_Word, +} +impl Clone for Elf64_Vernaux { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Copy)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +impl Clone for Elf32_auxv_t__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +impl Clone for Elf32_auxv_t { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Copy)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} +impl Clone for Elf64_auxv_t__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +impl Clone for Elf64_auxv_t { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Nhdr { + pub n_namesz: Elf32_Word, + pub n_descsz: Elf32_Word, + pub n_type: Elf32_Word, +} +impl Clone for Elf32_Nhdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Nhdr { + pub n_namesz: Elf64_Word, + pub n_descsz: Elf64_Word, + pub n_type: Elf64_Word, +} +impl Clone for Elf64_Nhdr { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Move { + pub m_value: Elf32_Xword, + pub m_info: Elf32_Word, + pub m_poffset: Elf32_Word, + pub m_repeat: Elf32_Half, + pub m_stride: Elf32_Half, +} +impl Clone for Elf32_Move { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Move { + pub m_value: Elf64_Xword, + pub m_info: Elf64_Xword, + pub m_poffset: Elf64_Xword, + pub m_repeat: Elf64_Half, + pub m_stride: Elf64_Half, +} +impl Clone for Elf64_Move { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Copy)] +pub union Elf32_gptab { + pub gt_header: Elf32_gptab__bindgen_ty_1, + pub gt_entry: Elf32_gptab__bindgen_ty_2, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_gptab__bindgen_ty_1 { + pub gt_current_g_value: Elf32_Word, + pub gt_unused: Elf32_Word, +} +impl Clone for Elf32_gptab__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_gptab__bindgen_ty_2 { + pub gt_g_value: Elf32_Word, + pub gt_bytes: Elf32_Word, +} +impl Clone for Elf32_gptab__bindgen_ty_2 { + fn clone(&self) -> Self { *self } +} +impl Clone for Elf32_gptab { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_RegInfo { + pub ri_gprmask: Elf32_Word, + pub ri_cprmask: [Elf32_Word; 4usize], + pub ri_gp_value: Elf32_Sword, +} +impl Clone for Elf32_RegInfo { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf_Options { + pub kind: u8, + pub size: u8, + pub section: Elf32_Section, + pub info: Elf32_Word, +} +impl Clone for Elf_Options { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf_Options_Hw { + pub hwp_flags1: Elf32_Word, + pub hwp_flags2: Elf32_Word, +} +impl Clone for Elf_Options_Hw { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf32_Lib { + pub l_name: Elf32_Word, + pub l_time_stamp: Elf32_Word, + pub l_checksum: Elf32_Word, + pub l_version: Elf32_Word, + pub l_flags: Elf32_Word, +} +impl Clone for Elf32_Lib { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Elf64_Lib { + pub l_name: Elf64_Word, + pub l_time_stamp: Elf64_Word, + pub l_checksum: Elf64_Word, + pub l_version: Elf64_Word, + pub l_flags: Elf64_Word, +} +impl Clone for Elf64_Lib { + fn clone(&self) -> Self { *self } +} +pub type Elf32_Conflict = Elf32_Addr; + +pub fn ELF32_R_SYM(info: Elf32_Word) -> Elf32_Word { info >> 8 } +pub fn ELF32_R_TYPE(info: Elf32_Word) -> u8 { info as u8 } +pub fn ELF32_R_INFO(sym: Elf32_Word, ty: u8) -> Elf32_Word { sym << 8 | ty as Elf32_Word } + +pub fn ELF32_ST_BIND(info: u8) -> u8 { info >> 4 } +pub fn ELF32_ST_TYPE(info: u8) -> u8 { info & 0xf } +pub fn ELF32_ST_INFO(bind: u8, ty: u8) -> u8 { (bind << 4) | (ty & 0xf) } diff --git a/artiq/firmware/libdyld/lib.rs b/artiq/firmware/libdyld/lib.rs new file mode 100644 index 000000000..1fec80bdc --- /dev/null +++ b/artiq/firmware/libdyld/lib.rs @@ -0,0 +1,313 @@ +#![no_std] +#![feature(untagged_unions, ptr_unaligned)] + +use core::{mem, ptr, fmt, slice, str, convert}; +use elf::*; + +pub mod elf; + +fn read_unaligned(data: &[u8], offset: usize) -> Result { + if data.len() < offset + mem::size_of::() { + Err(()) + } else { + let ptr = data.as_ptr().wrapping_offset(offset as isize) as *const T; + Ok(unsafe { ptr::read_unaligned(ptr) }) + } +} + +fn get_ref(data: &[u8], offset: usize) -> Result<&T, ()> { + if data.len() < offset + mem::size_of::() { + Err(()) + } else if (data.as_ptr() as usize + offset) & (mem::align_of::() - 1) != 0 { + Err(()) + } else { + let ptr = data.as_ptr().wrapping_offset(offset as isize) as *const T; + Ok(unsafe { &*ptr }) + } +} + +fn get_ref_slice(data: &[u8], offset: usize, len: usize) -> Result<&[T], ()> { + if data.len() < offset + mem::size_of::() * len { + Err(()) + } else if (data.as_ptr() as usize + offset) & (mem::align_of::() - 1) != 0 { + Err(()) + } else { + let ptr = data.as_ptr().wrapping_offset(offset as isize) as *const T; + Ok(unsafe { slice::from_raw_parts(ptr, len) }) + } +} + +fn elf_hash(name: &[u8]) -> u32 { + let mut h: u32 = 0; + for c in name { + h = (h << 4) + *c as u32; + let g = h & 0xf0000000; + if g != 0 { + h ^= g >> 24; + h &= !g; + } + } + h +} + +#[derive(Debug)] +pub enum Error<'a> { + Parsing(&'static str), + Lookup(&'a [u8]) +} + +impl<'a> convert::From<&'static str> for Error<'a> { + fn from(desc: &'static str) -> Error<'a> { + Error::Parsing(desc) + } +} + +impl<'a> fmt::Display for Error<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + &Error::Parsing(desc) => + write!(f, "parse error: {}", desc), + &Error::Lookup(sym) => + match str::from_utf8(sym) { + Ok(sym) => write!(f, "symbol lookup error: {}", sym), + Err(_) => write!(f, "symbol lookup error: {:?}", sym) + } + } + } +} + +pub struct Library<'a> { + image_off: Elf32_Addr, + image_sz: usize, + strtab: &'a [u8], + symtab: &'a [Elf32_Sym], + hash_bucket: &'a [Elf32_Word], + hash_chain: &'a [Elf32_Word], +} + +impl<'a> Library<'a> { + pub fn lookup(&self, name: &[u8]) -> Option { + let hash = elf_hash(name); + let mut index = self.hash_bucket[hash as usize % self.hash_bucket.len()] as usize; + + loop { + if index == STN_UNDEF { return None } + + let sym = &self.symtab[index]; + let sym_name_off = sym.st_name as usize; + match self.strtab.get(sym_name_off..sym_name_off + name.len()) { + Some(sym_name) if sym_name == name => { + if ELF32_ST_BIND(sym.st_info) & STB_GLOBAL == 0 { + return None + } + + match sym.st_shndx { + SHN_UNDEF => return None, + SHN_ABS => return Some(sym.st_value), + _ => return Some(self.image_off + sym.st_value) + } + } + _ => (), + } + + index = self.hash_chain[index] as usize; + } + } + + fn fixup_rela(&self, rela: &Elf32_Rela, resolve: &Fn(&[u8]) -> Option) + -> Result<(), Error<'a>> { + let sym; + if ELF32_R_SYM(rela.r_info) == 0 { + sym = None; + } else { + sym = Some(self.symtab.get(ELF32_R_SYM(rela.r_info) as usize) + .ok_or("symbol out of bounds of symbol table")?) + } + + let value; + match ELF32_R_TYPE(rela.r_info) { + R_OR1K_NONE => + return Ok(()), + + R_OR1K_RELATIVE => + value = self.image_off + rela.r_addend as Elf32_Word, + + R_OR1K_32 | R_OR1K_GLOB_DAT | R_OR1K_JMP_SLOT => { + let sym = sym.ok_or("relocation requires an associated symbol")?; + + let sym_name_off = sym.st_name as usize; + let sym_name_end = + self.strtab.iter().skip(sym_name_off).position(|&x| x == 0) + .ok_or("symbol in symbol table not null-terminated")?; + let sym_name = + self.strtab.get(sym_name_off..sym_name_off + sym_name_end) + .ok_or("cannot read symbol name")?; + + // First, try to resolve against itself. + match self.lookup(sym_name) { + Some(addr) => value = addr, + None => { + // Second, call the user-provided function. + match resolve(sym_name) { + Some(addr) => value = addr, + None => { + // We couldn't find it anywhere. + return Err(Error::Lookup(sym_name)) + } + } + } + } + } + + _ => return Err("unsupported relocation type")? + } + + if rela.r_offset as usize + mem::size_of::() > self.image_sz { + return Err("relocation out of image bounds")? + } + + let ptr = (self.image_off + rela.r_offset) as *mut Elf32_Addr; + unsafe { *ptr = value } + + Ok(()) + } + + pub fn load(data: &[u8], image: &'a mut [u8], resolve: &Fn(&[u8]) -> Option) + -> Result, Error<'a>> { + let ehdr = read_unaligned::(data, 0) + .map_err(|()| "cannot read ELF header")?; + + const IDENT: [u8; EI_NIDENT] = [ + ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, + ELFCLASS32, ELFDATA2MSB, EV_CURRENT, ELFOSABI_NONE, + /* ABI version */ 0, /* padding */ 0, 0, 0, 0, 0, 0, 0 + ]; + + #[cfg(target_arch = "or1k")] + const ARCH: u16 = EM_OPENRISC; + #[cfg(not(target_arch = "or1k"))] + const ARCH: u16 = EM_NONE; + + if ehdr.e_ident != IDENT || ehdr.e_type != ET_DYN || ehdr.e_machine != ARCH { + return Err("not a shared library for current architecture")? + } + + let mut dyn_off = None; + for i in 0..ehdr.e_phnum { + let phdr_off = ehdr.e_phoff as usize + mem::size_of::() * i as usize; + let phdr = read_unaligned::(data, phdr_off) + .map_err(|()| "cannot read program header")?; + + match phdr.p_type { + PT_LOAD => { + if (phdr.p_vaddr + phdr.p_filesz) as usize > image.len() || + (phdr.p_offset + phdr.p_filesz) as usize > data.len() { + return Err("program header requests an out of bounds load")? + } + let dst = image.get_mut(phdr.p_vaddr as usize.. + (phdr.p_vaddr + phdr.p_filesz) as usize) + .ok_or("cannot write to program header destination")?; + let src = data.get(phdr.p_offset as usize.. + (phdr.p_offset + phdr.p_filesz) as usize) + .ok_or("cannot read from program header source")?; + dst.copy_from_slice(src); + } + + PT_DYNAMIC => + dyn_off = Some(phdr.p_vaddr), + + _ => () + } + } + + let (mut strtab_off, mut strtab_sz) = (0, 0); + let (mut symtab_off, mut symtab_sz) = (0, 0); + let (mut rela_off, mut rela_sz) = (0, 0); + let (mut pltrel_off, mut pltrel_sz) = (0, 0); + let (mut hash_off, mut hash_sz) = (0, 0); + let mut sym_ent = 0; + let mut rela_ent = 0; + let mut nbucket = 0; + let mut nchain = 0; + + let dyn_off = dyn_off.ok_or("cannot find a dynamic header")?; + for i in 0.. { + let dyn_off = dyn_off as usize + i * mem::size_of::(); + let dyn = get_ref::(image, dyn_off) + .map_err(|()| "cannot read dynamic header")?; + + let val = unsafe { dyn.d_un.d_val } as usize; + match dyn.d_tag { + DT_NULL => break, + DT_REL => return Err("relocations with implicit addend are not supported")?, + DT_STRTAB => strtab_off = val, + DT_STRSZ => strtab_sz = val, + DT_SYMTAB => symtab_off = val, + DT_SYMENT => sym_ent = val, + DT_RELA => rela_off = val, + DT_RELASZ => rela_sz = val / mem::size_of::(), + DT_RELAENT => rela_ent = val, + DT_JMPREL => pltrel_off = val, + DT_PLTRELSZ => pltrel_sz = val / mem::size_of::(), + DT_HASH => { + nbucket = *get_ref::(image, val + 0) + .map_err(|()| "cannot read hash bucket count")? as usize; + nchain = *get_ref::(image, val + 4) + .map_err(|()| "cannot read hash chain count")? as usize; + hash_off = val + 8; + hash_sz = nbucket + nchain; + } + _ => () + } + } + + if sym_ent != mem::size_of::() { + return Err("incorrect symbol entry size")? + } + if rela_ent != mem::size_of::() { + return Err("incorrect relocation entry size")? + } + + // These are the same--there are as many chains as buckets, and the chains only contain + // the symbols that overflowed the bucket. + symtab_sz = nchain; + + // Drop the mutability. See also the comment below. + let image = &*image; + + let strtab = get_ref_slice::(image, strtab_off, strtab_sz) + .map_err(|()| "cannot read string table")?; + let symtab = get_ref_slice::(image, symtab_off, symtab_sz) + .map_err(|()| "cannot read symbol table")?; + let rela = get_ref_slice::(image, rela_off, rela_sz) + .map_err(|()| "cannot read rela entries")?; + let pltrel = get_ref_slice::(image, pltrel_off, pltrel_sz) + .map_err(|()| "cannot read pltrel entries")?; + let hash = get_ref_slice::(image, hash_off, hash_sz) + .map_err(|()| "cannot read hash entries")?; + + let library = Library { + image_off: image.as_ptr() as Elf32_Word, + image_sz: image.len(), + strtab: strtab, + symtab: symtab, + hash_bucket: &hash[..nbucket], + hash_chain: &hash[nbucket..nbucket + nchain], + }; + + // If a borrow exists anywhere, the borrowed memory cannot be mutated except + // through that pointer or it's UB. However, we need to retain pointers + // to the symbol tables and relocations, and at the same time mutate the code + // to resolve the relocations. + // + // To avoid invoking UB, we drop the only pointer to the entire area (which is + // unique since it's a &mut); we retain pointers to the various tables, but + // we never write to the memory they refer to, so it's safe. + mem::drop(image); + + for r in rela { library.fixup_rela(r, resolve)? } + for r in pltrel { library.fixup_rela(r, resolve)? } + + Ok(library) + } +} diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml index 45666668b..f82f104f6 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -19,6 +19,7 @@ logger_artiq = { path = "../liblogger_artiq" } cslice = { version = "0.3" } log = { version = "0.3", default-features = false, features = ["max_level_debug"] } board = { path = "../libboard", features = ["uart_console"] } +dyld = { path = "../libdyld" } drtioaux = { path = "../libdrtioaux" } fringe = { version = "= 1.1.0", default-features = false, features = ["alloc"] } byteorder = { version = "1.0", default-features = false } diff --git a/artiq/firmware/runtime/kernel_proto.rs b/artiq/firmware/runtime/kernel_proto.rs index f235c02ab..a29895e73 100644 --- a/artiq/firmware/runtime/kernel_proto.rs +++ b/artiq/firmware/runtime/kernel_proto.rs @@ -1,6 +1,7 @@ #![allow(dead_code)] use core::fmt; +use dyld; pub const KERNELCPU_EXEC_ADDRESS: usize = 0x40800000; pub const KERNELCPU_PAYLOAD_ADDRESS: usize = 0x40840000; @@ -22,7 +23,7 @@ pub struct Exception<'a> { #[derive(Debug)] pub enum Message<'a> { LoadRequest(&'a [u8]), - LoadReply(Result<(), &'a str>), + LoadReply(Result<(), dyld::Error<'a>>), NowInitRequest, NowInitReply(u64), diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index b8d477615..8a09e189e 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -16,6 +16,7 @@ extern crate smoltcp; extern crate board; #[cfg(has_drtio)] extern crate drtioaux; +extern crate dyld; use std::boxed::Box; use smoltcp::wire::{EthernetAddress, IpAddress}; diff --git a/artiq/firmware/runtime/session.rs b/artiq/firmware/runtime/session.rs index 85afb310f..d2b538c5f 100644 --- a/artiq/firmware/runtime/session.rs +++ b/artiq/firmware/runtime/session.rs @@ -179,7 +179,7 @@ unsafe fn kern_load(io: &Io, session: &mut Session, library: &[u8]) -> io::Resul session.kernel_state = KernelState::Loaded; Ok(()) } - &kern::LoadReply(Err(error)) => { + &kern::LoadReply(Err(ref error)) => { kernel::stop(); Err(io::Error::new(io::ErrorKind::Other, format!("cannot load kernel: {}", error))) From 13c6e96760d8486b8ba0349a843066a05a9ecccf Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 25 Feb 2017 00:10:40 +0000 Subject: [PATCH 3/8] firmware: implement dyld::Library::rebind. --- artiq/firmware/libdyld/lib.rs | 65 +++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/artiq/firmware/libdyld/lib.rs b/artiq/firmware/libdyld/lib.rs index 1fec80bdc..a331bf423 100644 --- a/artiq/firmware/libdyld/lib.rs +++ b/artiq/firmware/libdyld/lib.rs @@ -81,6 +81,8 @@ pub struct Library<'a> { image_sz: usize, strtab: &'a [u8], symtab: &'a [Elf32_Sym], + rela: &'a [Elf32_Rela], + pltrel: &'a [Elf32_Rela], hash_bucket: &'a [Elf32_Word], hash_chain: &'a [Elf32_Word], } @@ -114,7 +116,43 @@ impl<'a> Library<'a> { } } - fn fixup_rela(&self, rela: &Elf32_Rela, resolve: &Fn(&[u8]) -> Option) + fn name_starting_at(&self, offset: usize) -> Result<&'a [u8], Error<'a>> { + let size = self.strtab.iter().skip(offset).position(|&x| x == 0) + .ok_or("symbol in symbol table not null-terminated")?; + Ok(self.strtab.get(offset..offset + size) + .ok_or("cannot read symbol name")?) + } + + fn update_rela(&self, rela: &Elf32_Rela, value: Elf32_Word) -> Result<(), Error<'a>> { + if rela.r_offset as usize + mem::size_of::() > self.image_sz { + return Err("relocation out of image bounds")? + } + + let ptr = (self.image_off + rela.r_offset) as *mut Elf32_Addr; + Ok(unsafe { *ptr = value }) + } + + pub fn rebind(&self, name: &[u8], addr: Elf32_Word) -> Result<(), Error<'a>> { + for rela in self.rela.iter().chain(self.pltrel.iter()) { + match ELF32_R_TYPE(rela.r_info) { + R_OR1K_32 | R_OR1K_GLOB_DAT | R_OR1K_JMP_SLOT => { + let sym = self.symtab.get(ELF32_R_SYM(rela.r_info) as usize) + .ok_or("symbol out of bounds of symbol table")?; + let sym_name = self.name_starting_at(sym.st_name as usize)?; + + if sym_name == name { + self.update_rela(rela, addr)? + } + } + + // No associated symbols for other relocation types. + _ => () + } + } + Ok(()) + } + + fn resolve_rela(&self, rela: &Elf32_Rela, resolve: &Fn(&[u8]) -> Option) -> Result<(), Error<'a>> { let sym; if ELF32_R_SYM(rela.r_info) == 0 { @@ -134,14 +172,7 @@ impl<'a> Library<'a> { R_OR1K_32 | R_OR1K_GLOB_DAT | R_OR1K_JMP_SLOT => { let sym = sym.ok_or("relocation requires an associated symbol")?; - - let sym_name_off = sym.st_name as usize; - let sym_name_end = - self.strtab.iter().skip(sym_name_off).position(|&x| x == 0) - .ok_or("symbol in symbol table not null-terminated")?; - let sym_name = - self.strtab.get(sym_name_off..sym_name_off + sym_name_end) - .ok_or("cannot read symbol name")?; + let sym_name = self.name_starting_at(sym.st_name as usize)?; // First, try to resolve against itself. match self.lookup(sym_name) { @@ -162,14 +193,7 @@ impl<'a> Library<'a> { _ => return Err("unsupported relocation type")? } - if rela.r_offset as usize + mem::size_of::() > self.image_sz { - return Err("relocation out of image bounds")? - } - - let ptr = (self.image_off + rela.r_offset) as *mut Elf32_Addr; - unsafe { *ptr = value } - - Ok(()) + self.update_rela(rela, value) } pub fn load(data: &[u8], image: &'a mut [u8], resolve: &Fn(&[u8]) -> Option) @@ -291,6 +315,8 @@ impl<'a> Library<'a> { image_sz: image.len(), strtab: strtab, symtab: symtab, + rela: rela, + pltrel: pltrel, hash_bucket: &hash[..nbucket], hash_chain: &hash[nbucket..nbucket + nchain], }; @@ -305,8 +331,9 @@ impl<'a> Library<'a> { // we never write to the memory they refer to, so it's safe. mem::drop(image); - for r in rela { library.fixup_rela(r, resolve)? } - for r in pltrel { library.fixup_rela(r, resolve)? } + for r in rela.iter().chain(pltrel.iter()) { + library.resolve_rela(r, resolve)? + } Ok(library) } From d04e61123295465b1ab549cf3aa1c27449e93cb9 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 25 Feb 2017 14:12:58 +0000 Subject: [PATCH 4/8] firmware, compiler: rename rpc functions to be more consistent. --- artiq/compiler/transforms/llvm_ir_generator.py | 18 +++++++++--------- artiq/firmware/ksupport/api.rs | 6 +++--- artiq/firmware/ksupport/lib.rs | 8 ++++---- artiq/test/lit/embedding/async_rpc.py | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index 0240d8c61..f416cece5 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -340,11 +340,11 @@ class LLVMIRGenerator: llty = ll.FunctionType(llvoid, []) elif name == "memcmp": llty = ll.FunctionType(lli32, [llptr, llptr, lli32]) - elif name == "send_rpc": + elif name == "rpc_send": llty = ll.FunctionType(llvoid, [lli32, llsliceptr, llptrptr]) - elif name == "send_async_rpc": + elif name == "rpc_send_async": llty = ll.FunctionType(llvoid, [lli32, llsliceptr, llptrptr]) - elif name == "recv_rpc": + elif name == "rpc_recv": llty = ll.FunctionType(lli32, [llptr]) elif name == "now": llty = lli64 @@ -359,7 +359,7 @@ class LLVMIRGenerator: llglobal = ll.Function(self.llmodule, llty, name) if name in ("__artiq_raise", "__artiq_reraise", "llvm.trap"): llglobal.attributes.add("noreturn") - if name in ("rtio_log", "send_rpc", "send_async_rpc", + if name in ("rtio_log", "rpc_send", "rpc_send_async", "watchdog_set", "watchdog_clear", self.target.print_function): llglobal.attributes.add("nounwind") @@ -1242,10 +1242,10 @@ class LLVMIRGenerator: self.llbuilder.store(llargslot, llargptr) if fun_type.async: - self.llbuilder.call(self.llbuiltin("send_async_rpc"), + self.llbuilder.call(self.llbuiltin("rpc_send_async"), [llservice, lltagptr, llargs]) else: - self.llbuilder.call(self.llbuiltin("send_rpc"), + self.llbuilder.call(self.llbuiltin("rpc_send"), [llservice, lltagptr, llargs]) # Don't waste stack space on saved arguments. @@ -1257,7 +1257,7 @@ class LLVMIRGenerator: # T result = { # void *ret_ptr = alloca(sizeof(T)); # void *ptr = ret_ptr; - # loop: int size = recv_rpc(ptr); + # loop: int size = rpc_recv(ptr); # // Non-zero: Provide `size` bytes of extra storage for variable-length data. # if(size) { ptr = alloca(size); goto loop; } # else *(T*)ret_ptr @@ -1278,12 +1278,12 @@ class LLVMIRGenerator: llphi = self.llbuilder.phi(llslotgen.type, name="rpc.ptr") llphi.add_incoming(llslotgen, llprehead) if llunwindblock: - llsize = self.llbuilder.invoke(self.llbuiltin("recv_rpc"), [llphi], + llsize = self.llbuilder.invoke(self.llbuiltin("rpc_recv"), [llphi], llheadu, llunwindblock, name="rpc.size.next") self.llbuilder.position_at_end(llheadu) else: - llsize = self.llbuilder.call(self.llbuiltin("recv_rpc"), [llphi], + llsize = self.llbuilder.call(self.llbuiltin("rpc_recv"), [llphi], name="rpc.size.next") lldone = self.llbuilder.icmp_unsigned('==', llsize, ll.Constant(llsize.type, 0), name="rpc.done") diff --git a/artiq/firmware/ksupport/api.rs b/artiq/firmware/ksupport/api.rs index b01a8a60f..9a86d6ef5 100644 --- a/artiq/firmware/ksupport/api.rs +++ b/artiq/firmware/ksupport/api.rs @@ -86,9 +86,9 @@ static mut API: &'static [(&'static str, *const ())] = &[ api!(watchdog_set = ::watchdog_set), api!(watchdog_clear = ::watchdog_clear), - api!(send_rpc = ::send_rpc), - api!(send_async_rpc = ::send_async_rpc), - api!(recv_rpc = ::recv_rpc), + api!(rpc_send = ::rpc_send), + api!(rpc_send_async = ::rpc_send_async), + api!(rpc_recv = ::rpc_recv), api!(cache_get = ::cache_get), api!(cache_put = ::cache_put), diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index 034e53f8b..ff49d9296 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -121,7 +121,7 @@ extern fn abort() -> ! { loop {} } -extern fn send_rpc(service: u32, tag: CSlice, data: *const *const ()) { +extern fn rpc_send(service: u32, tag: CSlice, data: *const *const ()) { while !rpc_queue::empty() {} send(&RpcSend { async: false, @@ -131,7 +131,7 @@ extern fn send_rpc(service: u32, tag: CSlice, data: *const *const ()) { }) } -extern fn send_async_rpc(service: u32, tag: CSlice, data: *const *const ()) { +extern fn rpc_send_async(service: u32, tag: CSlice, data: *const *const ()) { while rpc_queue::full() {} rpc_queue::enqueue(|mut slice| { let length = { @@ -153,7 +153,7 @@ extern fn send_async_rpc(service: u32, tag: CSlice, data: *const *const ()) }) } -extern fn recv_rpc(slot: *mut ()) -> usize { +extern fn rpc_recv(slot: *mut ()) -> usize { send(&RpcRecvRequest(slot)); recv!(&RpcRecvReply(ref result) => { match result { @@ -281,7 +281,7 @@ unsafe fn attribute_writeback(typeinfo: *const ()) { attributes = attributes.offset(1); if (*attribute).tag.len() > 0 { - send_async_rpc(0, (*attribute).tag, [ + rpc_send_async(0, (*attribute).tag, [ &object as *const _ as *const (), &(*attribute).name as *const _ as *const (), (object as usize + (*attribute).offset) as *const () diff --git a/artiq/test/lit/embedding/async_rpc.py b/artiq/test/lit/embedding/async_rpc.py index 691a093c3..47c3041a5 100644 --- a/artiq/test/lit/embedding/async_rpc.py +++ b/artiq/test/lit/embedding/async_rpc.py @@ -4,7 +4,7 @@ from artiq.language.core import * from artiq.language.types import * -# CHECK: call void @send_async_rpc +# CHECK: call void @rpc_send_async @rpc(flags={"async"}) def foo(): From 2a81819eb0d38c992777473e34b8643a4aea6aec Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 25 Feb 2017 17:54:14 +0000 Subject: [PATCH 5/8] firmware: restructure to avoid #[path = "..."] mod ...; Such code is fragile, introduces mess in dependencies, and inflates compile times. --- artiq/firmware/Cargo.lock | 23 +++- artiq/firmware/ksupport/Cargo.toml | 10 +- artiq/firmware/ksupport/Makefile | 2 +- artiq/firmware/ksupport/eh.rs | 25 ++++ artiq/firmware/ksupport/lib.rs | 111 ++++++++---------- artiq/firmware/ksupport/rtio.rs | 15 +-- artiq/firmware/libamp/Cargo.toml | 11 ++ artiq/firmware/libamp/lib.rs | 6 + artiq/firmware/{runtime => libamp}/mailbox.rs | 0 .../firmware/{runtime => libamp}/rpc_queue.rs | 2 - artiq/firmware/libproto/Cargo.toml | 15 +++ .../{runtime => libproto}/analyzer_proto.rs | 2 +- .../{runtime/proto.rs => libproto/io.rs} | 5 +- .../{runtime => libproto}/kernel_proto.rs | 2 - artiq/firmware/libproto/lib.rs | 21 ++++ .../{runtime => libproto}/moninj_proto.rs | 2 +- .../{runtime => libproto}/rpc_proto.rs | 10 +- .../{runtime => libproto}/session_proto.rs | 5 +- artiq/firmware/runtime/Cargo.toml | 11 +- artiq/firmware/runtime/lib.rs | 25 ++-- 20 files changed, 190 insertions(+), 113 deletions(-) create mode 100644 artiq/firmware/libamp/Cargo.toml create mode 100644 artiq/firmware/libamp/lib.rs rename artiq/firmware/{runtime => libamp}/mailbox.rs (100%) rename artiq/firmware/{runtime => libamp}/rpc_queue.rs (98%) create mode 100644 artiq/firmware/libproto/Cargo.toml rename artiq/firmware/{runtime => libproto}/analyzer_proto.rs (97%) rename artiq/firmware/{runtime/proto.rs => libproto/io.rs} (96%) rename artiq/firmware/{runtime => libproto}/kernel_proto.rs (98%) create mode 100644 artiq/firmware/libproto/lib.rs rename artiq/firmware/{runtime => libproto}/moninj_proto.rs (99%) rename artiq/firmware/{runtime => libproto}/rpc_proto.rs (99%) rename artiq/firmware/{runtime => libproto}/session_proto.rs (99%) diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index 38e74d84f..efae082ed 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -10,6 +10,13 @@ version = "0.0.0" name = "alloc_none" version = "0.0.0" +[[package]] +name = "amp" +version = "0.0.0" +dependencies = [ + "board 0.0.0", +] + [[package]] name = "board" version = "0.0.0" @@ -93,11 +100,13 @@ name = "ksupport" version = "0.0.0" dependencies = [ "alloc_none 0.0.0", + "amp 0.0.0", "board 0.0.0", "build_artiq 0.0.0", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "dyld 0.0.0", + "proto 0.0.0", "std_artiq 0.0.0", ] @@ -130,21 +139,33 @@ name = "managed" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "proto" +version = "0.0.0" +dependencies = [ + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dyld 0.0.0", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "std_artiq 0.0.0", +] + [[package]] name = "runtime" version = "0.0.0" dependencies = [ "alloc_artiq 0.0.0", + "amp 0.0.0", "board 0.0.0", "build_artiq 0.0.0", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins?rev=631b568)", "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "drtioaux 0.0.0", - "dyld 0.0.0", "fringe 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "logger_artiq 0.0.0", + "proto 0.0.0", "smoltcp 0.2.1 (git+https://github.com/m-labs/smoltcp?rev=e8ece3e)", "std_artiq 0.0.0", ] diff --git a/artiq/firmware/ksupport/Cargo.toml b/artiq/firmware/ksupport/Cargo.toml index e0604d5eb..7cded1135 100644 --- a/artiq/firmware/ksupport/Cargo.toml +++ b/artiq/firmware/ksupport/Cargo.toml @@ -13,9 +13,11 @@ crate-type = ["staticlib"] build_artiq = { path = "../libbuild_artiq" } [dependencies] -alloc_none = { path = "../liballoc_none" } -std_artiq = { path = "../libstd_artiq" } -board = { path = "../libboard" } -dyld = { path = "../libdyld" } byteorder = { version = "1.0", default-features = false } cslice = { version = "0.3" } +alloc_none = { path = "../liballoc_none" } +std_artiq = { path = "../libstd_artiq" } +dyld = { path = "../libdyld" } +board = { path = "../libboard" } +proto = { path = "../libproto" } +amp = { path = "../libamp" } diff --git a/artiq/firmware/ksupport/Makefile b/artiq/firmware/ksupport/Makefile index 47a58f2fe..c45aea7a4 100644 --- a/artiq/firmware/ksupport/Makefile +++ b/artiq/firmware/ksupport/Makefile @@ -23,7 +23,7 @@ $(RUSTOUT)/libksupport.a: ksupport.elf: $(RUSTOUT)/libksupport.a glue.o $(LD) $(LDFLAGS) -T $(KSUPPORT_DIRECTORY)/ksupport.ld -o $@ $^ \ - -lbase -lm -lcompiler-rt -lunwind + -lunwind -lcompiler-rt -lbase -lm @chmod -x $@ %.o: $(KSUPPORT_DIRECTORY)/%.c diff --git a/artiq/firmware/ksupport/eh.rs b/artiq/firmware/ksupport/eh.rs index 171835cf4..05f7a68a0 100644 --- a/artiq/firmware/ksupport/eh.rs +++ b/artiq/firmware/ksupport/eh.rs @@ -433,3 +433,28 @@ pub unsafe extern fn reraise() -> ! { uw::_Unwind_Resume(&mut INFLIGHT.uw_exception) } } + +// Stub implementations for the functions the panic_unwind crate expects to be provided. +// These all do nothing in libunwind, but aren't built for OR1K. +pub mod stubs { + #![allow(bad_style, unused_variables)] + + use super::{uw, c_int}; + + #[export_name="_Unwind_GetIPInfo"] + pub unsafe extern fn _Unwind_GetIPInfo(ctx: *mut uw::_Unwind_Context, + ip_before_insn: *mut c_int) -> uw::_Unwind_Word { + *ip_before_insn = 0; + uw::_Unwind_GetIP(ctx) + } + + #[export_name="_Unwind_GetTextRelBase"] + pub unsafe extern fn _Unwind_GetTextRelBase(ctx: *mut uw::_Unwind_Context) -> uw::_Unwind_Ptr { + unimplemented!() + } + + #[export_name="_Unwind_GetDataRelBase"] + pub unsafe extern fn _Unwind_GetDataRelBase(ctx: *mut uw::_Unwind_Context) -> uw::_Unwind_Ptr { + unimplemented!() + } +} diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index ff49d9296..44375bfeb 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -1,54 +1,26 @@ #![feature(lang_items, asm, libc, panic_unwind, unwind_attributes)] #![no_std] -extern crate alloc_none; -#[macro_use] -extern crate std_artiq as std; extern crate unwind; extern crate libc; extern crate byteorder; -extern crate board; extern crate cslice; + +extern crate alloc_none; +extern crate std_artiq as std; + +extern crate board; extern crate dyld; - -#[path = "../runtime/mailbox.rs"] -mod mailbox; - -#[path = "../runtime/proto.rs"] -mod proto; -#[path = "../runtime/kernel_proto.rs"] -mod kernel_proto; -#[path = "../runtime/rpc_proto.rs"] -mod rpc_proto; - -mod api; +extern crate proto; +extern crate amp; use core::{mem, ptr, slice, str}; use std::io::Cursor; use cslice::{CSlice, AsCSlice}; -use kernel_proto::*; use dyld::Library; - -macro_rules! artiq_raise { - ($name:expr, $message:expr, $param0:expr, $param1:expr, $param2:expr) => ({ - use cslice::AsCSlice; - let exn = $crate::eh::Exception { - name: concat!("0:artiq.coredevice.exceptions.", $name).as_bytes().as_c_slice(), - file: file!().as_bytes().as_c_slice(), - line: line!(), - column: column!(), - // https://github.com/rust-lang/rfcs/pull/1719 - function: "(Rust function)".as_bytes().as_c_slice(), - message: $message.as_bytes().as_c_slice(), - param: [$param0, $param1, $param2] - }; - #[allow(unused_unsafe)] - unsafe { $crate::eh::raise(&exn) } - }); - ($name:expr, $message:expr) => ({ - artiq_raise!($name, $message, 0, 0, 0) - }); -} +use proto::{kernel_proto, rpc_proto}; +use proto::kernel_proto::*; +use amp::{mailbox, rpc_queue}; fn send(request: &Message) { unsafe { mailbox::send(request as *const _ as usize) } @@ -75,6 +47,14 @@ macro_rules! recv { } } +#[no_mangle] +#[lang = "panic_fmt"] +pub extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str, line: u32) -> ! { + send(&Log(format_args!("panic at {}:{}: {}", file, line, args))); + send(&RunAborted); + loop {} +} + macro_rules! print { ($($arg:tt)*) => ($crate::send(&$crate::kernel_proto::Log(format_args!($($arg)*)))); } @@ -84,19 +64,31 @@ macro_rules! println { ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); } -#[path = "../runtime/rpc_queue.rs"] -mod rpc_queue; -mod rtio; -mod eh; - -#[no_mangle] -#[lang = "panic_fmt"] -pub extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str, line: u32) -> ! { - println!("panic at {}:{}: {}", file, line, args); - send(&RunAborted); - loop {} +macro_rules! raise { + ($name:expr, $message:expr, $param0:expr, $param1:expr, $param2:expr) => ({ + use cslice::AsCSlice; + let exn = $crate::eh::Exception { + name: concat!("0:artiq.coredevice.exceptions.", $name).as_bytes().as_c_slice(), + file: file!().as_bytes().as_c_slice(), + line: line!(), + column: column!(), + // https://github.com/rust-lang/rfcs/pull/1719 + function: "(Rust function)".as_bytes().as_c_slice(), + message: $message.as_bytes().as_c_slice(), + param: [$param0, $param1, $param2] + }; + #[allow(unused_unsafe)] + unsafe { $crate::eh::raise(&exn) } + }); + ($name:expr, $message:expr) => ({ + raise!($name, $message, 0, 0, 0) + }); } +pub mod eh; +mod api; +mod rtio; + static mut NOW: u64 = 0; #[no_mangle] @@ -115,12 +107,6 @@ pub extern fn send_to_rtio_log(timestamp: i64, text: CSlice) { rtio::log(timestamp, text.as_ref()) } -extern fn abort() -> ! { - println!("kernel called abort()"); - send(&RunAborted); - loop {} -} - extern fn rpc_send(service: u32, tag: CSlice, data: *const *const ()) { while !rpc_queue::empty() {} send(&RpcSend { @@ -139,7 +125,7 @@ extern fn rpc_send_async(service: u32, tag: CSlice, data: *const *const ()) rpc_proto::send_args(&mut writer, service, tag.as_ref(), data)?; writer.position() }; - proto::write_u32(&mut slice, length as u32) + proto::io::write_u32(&mut slice, length as u32) }).unwrap_or_else(|err| { assert!(err.kind() == std::io::ErrorKind::WriteZero); @@ -202,7 +188,7 @@ fn terminate(exception: &eh::Exception, mut backtrace: &mut [usize]) -> ! { extern fn watchdog_set(ms: i64) -> i32 { if ms < 0 { - artiq_raise!("ValueError", "cannot set a watchdog with a negative timeout") + raise!("ValueError", "cannot set a watchdog with a negative timeout") } send(&WatchdogSetRequest { ms: ms as u64 }); @@ -227,7 +213,7 @@ extern fn cache_put(key: CSlice, list: CSlice) { }); recv!(&CachePutReply { succeeded } => { if !succeeded { - artiq_raise!("CacheError", "cannot put into a busy cache row") + raise!("CacheError", "cannot put into a busy cache row") } }) } @@ -329,6 +315,11 @@ pub unsafe fn main() { #[no_mangle] pub extern fn exception_handler(vect: u32, _regs: *const u32, pc: u32, ea: u32) { - println!("exception {:?} at PC 0x{:x}, EA 0x{:x}", vect, pc, ea); - send(&RunAborted) + panic!("exception {:?} at PC 0x{:x}, EA 0x{:x}", vect, pc, ea) +} + +// We don't export this because libbase does. +// #[no_mangle] +pub extern fn abort() { + panic!("aborted") } diff --git a/artiq/firmware/ksupport/rtio.rs b/artiq/firmware/ksupport/rtio.rs index 53443e763..83c5e4741 100644 --- a/artiq/firmware/ksupport/rtio.rs +++ b/artiq/firmware/ksupport/rtio.rs @@ -1,6 +1,3 @@ -#[path = "../runtime/kernel_proto.rs"] -mod kernel_proto; - use core::ptr::{read_volatile, write_volatile}; use cslice::CSlice; use board::csr; @@ -46,25 +43,25 @@ unsafe fn process_exceptional_status(timestamp: i64, channel: i32, status: u32) } if status & RTIO_O_STATUS_UNDERFLOW != 0 { csr::rtio::o_underflow_reset_write(1); - artiq_raise!("RTIOUnderflow", + raise!("RTIOUnderflow", "RTIO underflow at {0} mu, channel {1}, slack {2} mu", timestamp, channel as i64, timestamp - get_counter()) } if status & RTIO_O_STATUS_SEQUENCE_ERROR != 0 { csr::rtio::o_sequence_error_reset_write(1); - artiq_raise!("RTIOSequenceError", + raise!("RTIOSequenceError", "RTIO sequence error at {0} mu, channel {1}", timestamp, channel as i64, 0) } if status & RTIO_O_STATUS_COLLISION != 0 { csr::rtio::o_collision_reset_write(1); - artiq_raise!("RTIOCollision", + raise!("RTIOCollision", "RTIO collision at {0} mu, channel {1}", timestamp, channel as i64, 0) } if status & RTIO_O_STATUS_BUSY != 0 { csr::rtio::o_busy_reset_write(1); - artiq_raise!("RTIOBusy", + raise!("RTIOBusy", "RTIO busy on channel {0}", channel as i64, 0, 0) } @@ -122,7 +119,7 @@ pub extern fn input_timestamp(timeout: i64, channel: i32) -> u64 { } if status & RTIO_I_STATUS_OVERFLOW != 0 { - artiq_raise!("RTIOOverflow", + raise!("RTIOOverflow", "RTIO input overflow on channel {0}", channel as i64, 0, 0); } @@ -145,7 +142,7 @@ pub extern fn input_data(channel: i32) -> i32 { if status & RTIO_I_STATUS_OVERFLOW != 0 { csr::rtio::i_overflow_reset_write(1); - artiq_raise!("RTIOOverflow", + raise!("RTIOOverflow", "RTIO input overflow on channel {0}", channel as i64, 0, 0); } diff --git a/artiq/firmware/libamp/Cargo.toml b/artiq/firmware/libamp/Cargo.toml new file mode 100644 index 000000000..2607f80c2 --- /dev/null +++ b/artiq/firmware/libamp/Cargo.toml @@ -0,0 +1,11 @@ +[package] +authors = ["M-Labs"] +name = "amp" +version = "0.0.0" + +[lib] +name = "amp" +path = "lib.rs" + +[dependencies] +board = { path = "../libboard" } diff --git a/artiq/firmware/libamp/lib.rs b/artiq/firmware/libamp/lib.rs new file mode 100644 index 000000000..df46ef0c0 --- /dev/null +++ b/artiq/firmware/libamp/lib.rs @@ -0,0 +1,6 @@ +#![no_std] + +extern crate board; + +pub mod mailbox; +pub mod rpc_queue; diff --git a/artiq/firmware/runtime/mailbox.rs b/artiq/firmware/libamp/mailbox.rs similarity index 100% rename from artiq/firmware/runtime/mailbox.rs rename to artiq/firmware/libamp/mailbox.rs diff --git a/artiq/firmware/runtime/rpc_queue.rs b/artiq/firmware/libamp/rpc_queue.rs similarity index 98% rename from artiq/firmware/runtime/rpc_queue.rs rename to artiq/firmware/libamp/rpc_queue.rs index f19befcec..8f9f40f96 100644 --- a/artiq/firmware/runtime/rpc_queue.rs +++ b/artiq/firmware/libamp/rpc_queue.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use core::ptr::{read_volatile, write_volatile}; use core::slice; use board::{mem, cache}; diff --git a/artiq/firmware/libproto/Cargo.toml b/artiq/firmware/libproto/Cargo.toml new file mode 100644 index 000000000..487ae483b --- /dev/null +++ b/artiq/firmware/libproto/Cargo.toml @@ -0,0 +1,15 @@ +[package] +authors = ["M-Labs"] +name = "proto" +version = "0.0.0" + +[lib] +name = "proto" +path = "lib.rs" + +[dependencies] +byteorder = { version = "1.0", default-features = false } +cslice = { version = "0.3" } +log = { version = "0.3", default-features = false, optional = true } +std_artiq = { path = "../libstd_artiq", features = ["alloc"] } +dyld = { path = "../libdyld" } diff --git a/artiq/firmware/runtime/analyzer_proto.rs b/artiq/firmware/libproto/analyzer_proto.rs similarity index 97% rename from artiq/firmware/runtime/analyzer_proto.rs rename to artiq/firmware/libproto/analyzer_proto.rs index 8c103779f..27151b3bf 100644 --- a/artiq/firmware/runtime/analyzer_proto.rs +++ b/artiq/firmware/libproto/analyzer_proto.rs @@ -1,5 +1,5 @@ use std::io::{self, Write}; -use proto::*; +use io::*; #[derive(Debug)] pub struct Header { diff --git a/artiq/firmware/runtime/proto.rs b/artiq/firmware/libproto/io.rs similarity index 96% rename from artiq/firmware/runtime/proto.rs rename to artiq/firmware/libproto/io.rs index 21cdde62e..c91f606f1 100644 --- a/artiq/firmware/runtime/proto.rs +++ b/artiq/firmware/libproto/io.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use std::io::{self, Read, Write}; use std::vec::Vec; use std::string::String; @@ -55,7 +53,8 @@ pub fn write_u64(writer: &mut Write, value: u64) -> io::Result<()> { pub fn read_bytes(reader: &mut Read) -> io::Result> { let length = read_u32(reader)?; - let mut value = vec![0; length as usize]; + let mut value = Vec::new(); + value.resize(length as usize, 0); reader.read_exact(&mut value)?; Ok(value) } diff --git a/artiq/firmware/runtime/kernel_proto.rs b/artiq/firmware/libproto/kernel_proto.rs similarity index 98% rename from artiq/firmware/runtime/kernel_proto.rs rename to artiq/firmware/libproto/kernel_proto.rs index a29895e73..1e776b876 100644 --- a/artiq/firmware/runtime/kernel_proto.rs +++ b/artiq/firmware/libproto/kernel_proto.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use core::fmt; use dyld; diff --git a/artiq/firmware/libproto/lib.rs b/artiq/firmware/libproto/lib.rs new file mode 100644 index 000000000..97d95adad --- /dev/null +++ b/artiq/firmware/libproto/lib.rs @@ -0,0 +1,21 @@ +#![no_std] + +extern crate byteorder; +extern crate cslice; +#[cfg(feature = "log")] +#[macro_use] +extern crate log; + +extern crate dyld; +extern crate std_artiq as std; + +pub mod io; + +// Internal protocols. +pub mod kernel_proto; + +// External protocols. +pub mod analyzer_proto; +pub mod moninj_proto; +pub mod session_proto; +pub mod rpc_proto; diff --git a/artiq/firmware/runtime/moninj_proto.rs b/artiq/firmware/libproto/moninj_proto.rs similarity index 99% rename from artiq/firmware/runtime/moninj_proto.rs rename to artiq/firmware/libproto/moninj_proto.rs index ef287b696..15934b849 100644 --- a/artiq/firmware/runtime/moninj_proto.rs +++ b/artiq/firmware/libproto/moninj_proto.rs @@ -1,5 +1,5 @@ use std::io::{self, Read, Write}; -use proto::*; +use io::*; #[derive(Debug)] pub enum TtlMode { diff --git a/artiq/firmware/runtime/rpc_proto.rs b/artiq/firmware/libproto/rpc_proto.rs similarity index 99% rename from artiq/firmware/runtime/rpc_proto.rs rename to artiq/firmware/libproto/rpc_proto.rs index bae3ea079..0918e0637 100644 --- a/artiq/firmware/runtime/rpc_proto.rs +++ b/artiq/firmware/libproto/rpc_proto.rs @@ -1,9 +1,7 @@ -#![allow(dead_code)] - -use core::str; use std::io::{self, Read, Write}; +use std::str; use cslice::{CSlice, CMutSlice}; -use proto::*; +use io::*; use self::tag::{Tag, TagIterator, split_tag}; unsafe fn recv_value(reader: &mut Read, tag: Tag, data: &mut *mut (), @@ -76,7 +74,7 @@ unsafe fn recv_value(reader: &mut Read, tag: Tag, data: &mut *mut (), pub fn recv_return(reader: &mut Read, tag_bytes: &[u8], data: *mut (), alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> { let mut it = TagIterator::new(tag_bytes); - #[cfg(not(ksupport))] + #[cfg(feature = "log")] trace!("recv ...->{}", it); let tag = it.next().expect("truncated tag"); @@ -162,7 +160,7 @@ pub fn send_args(writer: &mut Write, service: u32, tag_bytes: &[u8], let (arg_tags_bytes, return_tag_bytes) = split_tag(tag_bytes); let mut args_it = TagIterator::new(arg_tags_bytes); - #[cfg(not(ksupport))] + #[cfg(feature = "log")] { let return_it = TagIterator::new(return_tag_bytes); trace!("send<{}>({})->{}", service, args_it, return_it); diff --git a/artiq/firmware/runtime/session_proto.rs b/artiq/firmware/libproto/session_proto.rs similarity index 99% rename from artiq/firmware/runtime/session_proto.rs rename to artiq/firmware/libproto/session_proto.rs index c30bf7eed..7448e1550 100644 --- a/artiq/firmware/runtime/session_proto.rs +++ b/artiq/firmware/libproto/session_proto.rs @@ -1,6 +1,7 @@ -use std::prelude::v1::*; use std::io::{self, Read, Write}; -use proto::*; +use std::vec::Vec; +use std::string::String; +use io::*; fn read_sync(reader: &mut Read) -> io::Result<()> { let mut sync = [0; 4]; diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml index f82f104f6..1c7fcd2b0 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -13,16 +13,17 @@ path = "lib.rs" build_artiq = { path = "../libbuild_artiq" } [dependencies] +byteorder = { version = "1.0", default-features = false } +cslice = { version = "0.3" } +log = { version = "0.3", default-features = false, features = ["max_level_debug"] } +fringe = { version = "= 1.1.0", default-features = false, features = ["alloc"] } alloc_artiq = { path = "../liballoc_artiq" } std_artiq = { path = "../libstd_artiq", features = ["alloc"] } logger_artiq = { path = "../liblogger_artiq" } -cslice = { version = "0.3" } -log = { version = "0.3", default-features = false, features = ["max_level_debug"] } board = { path = "../libboard", features = ["uart_console"] } -dyld = { path = "../libdyld" } +proto = { path = "../libproto", features = ["log"] } +amp = { path = "../libamp" } drtioaux = { path = "../libdrtioaux" } -fringe = { version = "= 1.1.0", default-features = false, features = ["alloc"] } -byteorder = { version = "1.0", default-features = false } [dependencies.compiler_builtins] git = "https://github.com/rust-lang-nursery/compiler-builtins" diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index 8a09e189e..230545957 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -2,24 +2,28 @@ #![feature(compiler_builtins_lib, repr_simd, const_fn)] extern crate compiler_builtins; -extern crate alloc_artiq; -#[macro_use] -extern crate std_artiq as std; extern crate cslice; #[macro_use] extern crate log; -extern crate logger_artiq; extern crate byteorder; extern crate fringe; extern crate smoltcp; + +extern crate alloc_artiq; +#[macro_use] +extern crate std_artiq as std; +extern crate logger_artiq; #[macro_use] extern crate board; +extern crate proto; +extern crate amp; #[cfg(has_drtio)] extern crate drtioaux; -extern crate dyld; use std::boxed::Box; use smoltcp::wire::{EthernetAddress, IpAddress}; +use proto::{analyzer_proto, moninj_proto, rpc_proto, session_proto, kernel_proto}; +use amp::{mailbox, rpc_queue}; macro_rules! borrow_mut { ($x:expr) => ({ @@ -33,22 +37,11 @@ macro_rules! borrow_mut { mod config; mod ethmac; mod rtio_mgt; -mod mailbox; -mod rpc_queue; mod urc; mod sched; mod cache; -mod proto; -mod kernel_proto; -mod session_proto; -#[cfg(has_rtio_moninj)] -mod moninj_proto; -#[cfg(has_rtio_analyzer)] -mod analyzer_proto; -mod rpc_proto; - mod kernel; mod session; #[cfg(has_rtio_moninj)] From a07bd918f0763469e8d786ff195d621f73d13476 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 25 Feb 2017 22:34:11 +0000 Subject: [PATCH 6/8] firmware: use Rust naming conventions for enum variants. --- artiq/firmware/ksupport/lib.rs | 12 +++---- artiq/firmware/ksupport/rtio.rs | 18 +++++------ artiq/firmware/libproto/kernel_proto.rs | 30 +++++++++--------- artiq/firmware/runtime/session.rs | 42 ++++++++++++------------- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index 44375bfeb..09c3c6fe2 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -219,21 +219,21 @@ extern fn cache_put(key: CSlice, list: CSlice) { } extern fn i2c_start(busno: i32) { - send(&I2CStartRequest { busno: busno as u8 }); + send(&I2cStartRequest { busno: busno as u8 }); } extern fn i2c_stop(busno: i32) { - send(&I2CStopRequest { busno: busno as u8 }); + send(&I2cStopRequest { busno: busno as u8 }); } extern fn i2c_write(busno: i32, data: i32) -> bool { - send(&I2CWriteRequest { busno: busno as u8, data: data as u8 }); - recv!(&I2CWriteReply { ack } => ack) + send(&I2cWriteRequest { busno: busno as u8, data: data as u8 }); + recv!(&I2cWriteReply { ack } => ack) } extern fn i2c_read(busno: i32, ack: bool) -> i32 { - send(&I2CReadRequest { busno: busno as u8, ack: ack }); - recv!(&I2CReadReply { data } => data) as i32 + send(&I2cReadRequest { busno: busno as u8, ack: ack }); + recv!(&I2cReadReply { data } => data) as i32 } unsafe fn attribute_writeback(typeinfo: *const ()) { diff --git a/artiq/firmware/ksupport/rtio.rs b/artiq/firmware/ksupport/rtio.rs index 83c5e4741..a63bed8c4 100644 --- a/artiq/firmware/ksupport/rtio.rs +++ b/artiq/firmware/ksupport/rtio.rs @@ -13,7 +13,7 @@ const RTIO_I_STATUS_EMPTY: u32 = 1; const RTIO_I_STATUS_OVERFLOW: u32 = 2; pub extern fn init() { - send(&RTIOInitRequest); + send(&RtioInitRequest); } pub extern fn get_counter() -> i64 { @@ -190,31 +190,31 @@ pub mod drtio_dbg { pub struct ChannelState(i32, i64); pub extern fn get_channel_state(channel: i32) -> ChannelState { - send(&DRTIOChannelStateRequest { channel: channel as u32 }); - recv!(&DRTIOChannelStateReply { fifo_space, last_timestamp } + send(&DrtioChannelStateRequest { channel: channel as u32 }); + recv!(&DrtioChannelStateReply { fifo_space, last_timestamp } => ChannelState(fifo_space as i32, last_timestamp as i64)) } pub extern fn reset_channel_state(channel: i32) { - send(&DRTIOResetChannelStateRequest { channel: channel as u32 }) + send(&DrtioResetChannelStateRequest { channel: channel as u32 }) } pub extern fn get_fifo_space(channel: i32) { - send(&DRTIOGetFIFOSpaceRequest { channel: channel as u32 }) + send(&DrtioGetFifoSpaceRequest { channel: channel as u32 }) } #[repr(C)] pub struct PacketCounts(i32, i32); pub extern fn get_packet_counts() -> PacketCounts { - send(&DRTIOPacketCountRequest); - recv!(&DRTIOPacketCountReply { tx_cnt, rx_cnt } + send(&DrtioPacketCountRequest); + recv!(&DrtioPacketCountReply { tx_cnt, rx_cnt } => PacketCounts(tx_cnt as i32, rx_cnt as i32)) } pub extern fn get_fifo_space_req_count() -> i32 { - send(&DRTIOFIFOSpaceReqCountRequest); - recv!(&DRTIOFIFOSpaceReqCountReply { cnt } + send(&DrtioFifoSpaceReqCountRequest); + recv!(&DrtioFifoSpaceReqCountReply { cnt } => cnt as i32) } } diff --git a/artiq/firmware/libproto/kernel_proto.rs b/artiq/firmware/libproto/kernel_proto.rs index 1e776b876..5e7238360 100644 --- a/artiq/firmware/libproto/kernel_proto.rs +++ b/artiq/firmware/libproto/kernel_proto.rs @@ -27,16 +27,16 @@ pub enum Message<'a> { NowInitReply(u64), NowSave(u64), - RTIOInitRequest, + RtioInitRequest, - DRTIOChannelStateRequest { channel: u32 }, - DRTIOChannelStateReply { fifo_space: u16, last_timestamp: u64 }, - DRTIOResetChannelStateRequest { channel: u32 }, - DRTIOGetFIFOSpaceRequest { channel: u32 }, - DRTIOPacketCountRequest, - DRTIOPacketCountReply { tx_cnt: u32, rx_cnt: u32 }, - DRTIOFIFOSpaceReqCountRequest, - DRTIOFIFOSpaceReqCountReply { cnt: u32 }, + DrtioChannelStateRequest { channel: u32 }, + DrtioChannelStateReply { fifo_space: u16, last_timestamp: u64 }, + DrtioResetChannelStateRequest { channel: u32 }, + DrtioGetFifoSpaceRequest { channel: u32 }, + DrtioPacketCountRequest, + DrtioPacketCountReply { tx_cnt: u32, rx_cnt: u32 }, + DrtioFifoSpaceReqCountRequest, + DrtioFifoSpaceReqCountReply { cnt: u32 }, RunFinished, RunException { @@ -63,12 +63,12 @@ pub enum Message<'a> { CachePutRequest { key: &'a str, value: &'a [i32] }, CachePutReply { succeeded: bool }, - I2CStartRequest { busno: u8 }, - I2CStopRequest { busno: u8 }, - I2CWriteRequest { busno: u8, data: u8 }, - I2CWriteReply { ack: bool }, - I2CReadRequest { busno: u8, ack: bool }, - I2CReadReply { data: u8 }, + I2cStartRequest { busno: u8 }, + I2cStopRequest { busno: u8 }, + I2cWriteRequest { busno: u8, data: u8 }, + I2cWriteReply { ack: bool }, + I2cReadRequest { busno: u8, ack: bool }, + I2cReadReply { data: u8 }, Log(fmt::Arguments<'a>), LogSlice(&'a str) diff --git a/artiq/firmware/runtime/session.rs b/artiq/firmware/runtime/session.rs index d2b538c5f..13652bbf7 100644 --- a/artiq/firmware/runtime/session.rs +++ b/artiq/firmware/runtime/session.rs @@ -388,32 +388,32 @@ fn process_kern_message(io: &Io, kern_acknowledge() } - &kern::RTIOInitRequest => { + &kern::RtioInitRequest => { info!("resetting RTIO"); rtio_mgt::init_core(); kern_acknowledge() } - &kern::DRTIOChannelStateRequest { channel } => { + &kern::DrtioChannelStateRequest { channel } => { let (fifo_space, last_timestamp) = rtio_mgt::drtio_dbg::get_channel_state(channel); - kern_send(io, &kern::DRTIOChannelStateReply { fifo_space: fifo_space, + kern_send(io, &kern::DrtioChannelStateReply { fifo_space: fifo_space, last_timestamp: last_timestamp }) } - &kern::DRTIOResetChannelStateRequest { channel } => { + &kern::DrtioResetChannelStateRequest { channel } => { rtio_mgt::drtio_dbg::reset_channel_state(channel); kern_acknowledge() } - &kern::DRTIOGetFIFOSpaceRequest { channel } => { + &kern::DrtioGetFifoSpaceRequest { channel } => { rtio_mgt::drtio_dbg::get_fifo_space(channel); kern_acknowledge() } - &kern::DRTIOPacketCountRequest => { + &kern::DrtioPacketCountRequest => { let (tx_cnt, rx_cnt) = rtio_mgt::drtio_dbg::get_packet_counts(); - kern_send(io, &kern::DRTIOPacketCountReply { tx_cnt: tx_cnt, rx_cnt: rx_cnt }) + kern_send(io, &kern::DrtioPacketCountReply { tx_cnt: tx_cnt, rx_cnt: rx_cnt }) } - &kern::DRTIOFIFOSpaceReqCountRequest => { + &kern::DrtioFifoSpaceReqCountRequest => { let cnt = rtio_mgt::drtio_dbg::get_fifo_space_req_count(); - kern_send(io, &kern::DRTIOFIFOSpaceReqCountReply { cnt: cnt }) + kern_send(io, &kern::DrtioFifoSpaceReqCountReply { cnt: cnt }) } &kern::WatchdogSetRequest { ms } => { @@ -454,41 +454,41 @@ fn process_kern_message(io: &Io, } #[cfg(has_i2c)] - &kern::I2CStartRequest { busno } => { + &kern::I2cStartRequest { busno } => { board::i2c::start(busno); kern_acknowledge() } #[cfg(has_i2c)] - &kern::I2CStopRequest { busno } => { + &kern::I2cStopRequest { busno } => { board::i2c::stop(busno); kern_acknowledge() } #[cfg(has_i2c)] - &kern::I2CWriteRequest { busno, data } => { + &kern::I2cWriteRequest { busno, data } => { let ack = board::i2c::write(busno, data); - kern_send(io, &kern::I2CWriteReply { ack: ack }) + kern_send(io, &kern::I2cWriteReply { ack: ack }) } #[cfg(has_i2c)] - &kern::I2CReadRequest { busno, ack } => { + &kern::I2cReadRequest { busno, ack } => { let data = board::i2c::read(busno, ack); - kern_send(io, &kern::I2CReadReply { data: data }) + kern_send(io, &kern::I2cReadReply { data: data }) } #[cfg(not(has_i2c))] - &kern::I2CStartRequest { .. } => { + &kern::I2cStartRequest { .. } => { kern_acknowledge() } #[cfg(not(has_i2c))] - &kern::I2CStopRequest { .. } => { + &kern::I2cStopRequest { .. } => { kern_acknowledge() } #[cfg(not(has_i2c))] - &kern::I2CWriteRequest { .. } => { - kern_send(io, &kern::I2CWriteReply { ack: false }) + &kern::I2cWriteRequest { .. } => { + kern_send(io, &kern::I2cWriteReply { ack: false }) } #[cfg(not(has_i2c))] - &kern::I2CReadRequest { .. } => { - kern_send(io, &kern::I2CReadReply { data: 0xff }) + &kern::I2cReadRequest { .. } => { + kern_send(io, &kern::I2cReadReply { data: 0xff }) } &kern::RunFinished => { From 3a1f14c16c5482274560a382059c6a10f74f052b Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 26 Feb 2017 01:58:21 +0000 Subject: [PATCH 7/8] compiler: fix overly strict constness analysis. Before this commit, the following code would fail to compile... obj.foo.bar = True ... if foo is marked kernel_invariant in obj, even if bar is not marked as such in obj.foo. --- artiq/compiler/analyses/constness.py | 5 ++++- artiq/test/lit/embedding/invariant_nested.py | 22 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 artiq/test/lit/embedding/invariant_nested.py diff --git a/artiq/compiler/analyses/constness.py b/artiq/compiler/analyses/constness.py index add1f7fac..c6458497f 100644 --- a/artiq/compiler/analyses/constness.py +++ b/artiq/compiler/analyses/constness.py @@ -24,7 +24,10 @@ class Constness(algorithm.Visitor): self.in_assign = old_in_assign def visit_AttributeT(self, node): - self.generic_visit(node) + old_in_assign, self.in_assign = self.in_assign, False + self.visit(node.value) + self.in_assign = old_in_assign + if self.in_assign: typ = node.value.type.find() if types.is_instance(typ) and node.attr in typ.constant_attributes: diff --git a/artiq/test/lit/embedding/invariant_nested.py b/artiq/test/lit/embedding/invariant_nested.py new file mode 100644 index 000000000..5957dcb3d --- /dev/null +++ b/artiq/test/lit/embedding/invariant_nested.py @@ -0,0 +1,22 @@ +# RUN: %python -m artiq.compiler.testbench.embedding %s + +from artiq.language.core import * +from artiq.language.types import * + + +class ClassA: + def __init__(self): + self.foo = False + + +class ClassB: + kernel_invariants = {"bar"} + + def __init__(self): + self.bar = ClassA() + +obj = ClassB() + +@kernel +def entrypoint(): + obj.bar.foo = True From 5d3b00cf12610b438cbd7687d6c4ce7c92318353 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 26 Feb 2017 02:50:20 +0000 Subject: [PATCH 8/8] Implement recording of DMA traces on the core device. --- artiq/coredevice/dma.py | 55 ++++++++++++++++++ artiq/coredevice/exceptions.py | 4 ++ artiq/examples/master/device_db.pyon | 5 ++ artiq/firmware/ksupport/api.rs | 3 + artiq/firmware/ksupport/lib.rs | 76 ++++++++++++++++++++++--- artiq/firmware/libdyld/lib.rs | 12 ++-- artiq/firmware/libproto/kernel_proto.rs | 9 +++ artiq/firmware/runtime/lib.rs | 1 + artiq/firmware/runtime/rtio_dma.rs | 58 +++++++++++++++++++ artiq/firmware/runtime/session.rs | 19 ++++++- doc/manual/core_drivers_reference.rst | 6 ++ 11 files changed, 231 insertions(+), 17 deletions(-) create mode 100644 artiq/coredevice/dma.py create mode 100644 artiq/firmware/runtime/rtio_dma.rs diff --git a/artiq/coredevice/dma.py b/artiq/coredevice/dma.py new file mode 100644 index 000000000..26357cd55 --- /dev/null +++ b/artiq/coredevice/dma.py @@ -0,0 +1,55 @@ +from artiq.language.core import syscall, kernel +from artiq.language.types import TStr, TNone + +from numpy import int64 + + +@syscall +def dma_record_start() -> TNone: + raise NotImplementedError("syscall not simulated") + + +@syscall +def dma_record_stop(name: TStr) -> TNone: + raise NotImplementedError("syscall not simulated") + + +class DMARecordContextManager: + def __init__(self): + self.name = "" + self.saved_now_mu = int64(0) + + @kernel + def __enter__(self): + """Starts recording a DMA trace. All RTIO operations are redirected to + a newly created DMA buffer after this call, and ``now`` is reset to zero.""" + dma_record_start() # this may raise, so do it before altering now + self.saved_now_mu = now_mu() + at_mu(0) + + @kernel + def __exit__(self, type, value, traceback): + """Stops recording a DMA trace. All recorded RTIO operations are stored + in a newly created trace called ``self.name``, and ``now`` is restored + to the value it had before ``__enter__`` was called.""" + dma_record_stop(self.name) # see above + at_mu(self.saved_now_mu) + + +class CoreDMA: + """Core device Direct Memory Access (DMA) driver. + + Gives access to the DMA functionality of the core device. + """ + + kernel_invariants = {"core", "recorder"} + + def __init__(self, dmgr, core_device="core"): + self.core = dmgr.get(core_device) + self.recorder = DMARecordContextManager() + + @kernel + def record(self, name): + """Returns a context manager that will record a DMA trace called ``name``.""" + self.recorder.name = name + return self.recorder diff --git a/artiq/coredevice/exceptions.py b/artiq/coredevice/exceptions.py index 58c07fec3..bc1e10998 100644 --- a/artiq/coredevice/exceptions.py +++ b/artiq/coredevice/exceptions.py @@ -120,6 +120,10 @@ class RTIOOverflow(Exception): """ artiq_builtin = True +class DMAError(Exception): + """Raised when performing an invalid DMA operation.""" + artiq_builtin = True + class DDSError(Exception): """Raised when attempting to start a DDS batch while already in a batch, when too many commands are batched, and when DDS channel settings are diff --git a/artiq/examples/master/device_db.pyon b/artiq/examples/master/device_db.pyon index a8a8f63d8..ec9bc6083 100644 --- a/artiq/examples/master/device_db.pyon +++ b/artiq/examples/master/device_db.pyon @@ -20,6 +20,11 @@ "module": "artiq.coredevice.cache", "class": "CoreCache" }, + "core_dma": { + "type": "local", + "module": "artiq.coredevice.dma", + "class": "CoreDMA" + }, "core_dds": { "type": "local", "module": "artiq.coredevice.dds", diff --git a/artiq/firmware/ksupport/api.rs b/artiq/firmware/ksupport/api.rs index 9a86d6ef5..35fffcb28 100644 --- a/artiq/firmware/ksupport/api.rs +++ b/artiq/firmware/ksupport/api.rs @@ -105,6 +105,9 @@ static mut API: &'static [(&'static str, *const ())] = &[ api!(rtio_input_timestamp = ::rtio::input_timestamp), api!(rtio_input_data = ::rtio::input_data), + api!(dma_record_start = ::dma_record_start), + api!(dma_record_stop = ::dma_record_stop), + api!(drtio_get_channel_state = ::rtio::drtio_dbg::get_channel_state), api!(drtio_reset_channel_state = ::rtio::drtio_dbg::reset_channel_state), api!(drtio_get_fifo_space = ::rtio::drtio_dbg::get_fifo_space), diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index 09c3c6fe2..3a0e7e881 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -36,11 +36,11 @@ fn recv R>(f: F) -> R { macro_rules! recv { ($p:pat => $e:expr) => { - recv(|request| { + recv(move |request| { if let $p = request { $e } else { - send(&Log(format_args!("unexpected reply: {:?}", request))); + send(&Log(format_args!("unexpected reply: {:?}\n", request))); loop {} } }) @@ -50,7 +50,7 @@ macro_rules! recv { #[no_mangle] #[lang = "panic_fmt"] pub extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str, line: u32) -> ! { - send(&Log(format_args!("panic at {}:{}: {}", file, line, args))); + send(&Log(format_args!("panic at {}:{}: {}\n", file, line, args))); send(&RunAborted); loop {} } @@ -90,6 +90,7 @@ mod api; mod rtio; static mut NOW: u64 = 0; +static mut LIBRARY: Option> = None; #[no_mangle] pub extern fn send_to_core_log(text: CSlice) { @@ -236,6 +237,61 @@ extern fn i2c_read(busno: i32, ack: bool) -> i32 { recv!(&I2cReadReply { data } => data) as i32 } +static mut DMA_RECORDING: bool = false; + +extern fn dma_record_start() { + unsafe { + if DMA_RECORDING { + raise!("DMAError", "DMA is already recording") + } + + let library = LIBRARY.as_ref().unwrap(); + library.rebind(b"rtio_output", + dma_record_output as *const () as u32).unwrap(); + library.rebind(b"rtio_output_wide", + dma_record_output_wide as *const () as u32).unwrap(); + + DMA_RECORDING = true; + send(&DmaRecordStart); + } +} + +extern fn dma_record_stop(name: CSlice) { + unsafe { + if !DMA_RECORDING { + raise!("DMAError", "DMA is not recording") + } + + let library = LIBRARY.as_ref().unwrap(); + library.rebind(b"rtio_output", + rtio::output as *const () as u32).unwrap(); + library.rebind(b"rtio_output_wide", + rtio::output_wide as *const () as u32).unwrap(); + + DMA_RECORDING = false; + send(&DmaRecordStop(str::from_utf8(name.as_ref()).unwrap())); + } +} + +extern fn dma_record_output(timestamp: i64, channel: i32, address: i32, data: i32) { + send(&DmaRecordAppend { + timestamp: timestamp as u64, + channel: channel as u32, + address: address as u32, + data: &[data as u32] + }) +} + +extern fn dma_record_output_wide(timestamp: i64, channel: i32, address: i32, data: CSlice) { + assert!(data.len() <= 16); // enforce the hardware limit + send(&DmaRecordAppend { + timestamp: timestamp as u64, + channel: channel as u32, + address: address as u32, + data: unsafe { mem::transmute::<&[i32], &[u32]>(data.as_ref()) } + }) +} + unsafe fn attribute_writeback(typeinfo: *const ()) { struct Attr { offset: usize, @@ -248,9 +304,6 @@ unsafe fn attribute_writeback(typeinfo: *const ()) { objects: *const *const () } - // artiq_compile'd kernels don't include type information - if typeinfo.is_null() { return } - let mut tys = typeinfo as *const *const Type; while !(*tys).is_null() { let ty = *tys; @@ -299,14 +352,21 @@ pub unsafe fn main() { let __bss_start = library.lookup(b"__bss_start").unwrap(); let _end = library.lookup(b"_end").unwrap(); + let __modinit__ = library.lookup(b"__modinit__").unwrap(); + let typeinfo = library.lookup(b"typeinfo"); + + LIBRARY = Some(library); + ptr::write_bytes(__bss_start as *mut u8, 0, (_end - __bss_start) as usize); send(&NowInitRequest); recv!(&NowInitReply(now) => NOW = now); - (mem::transmute::(library.lookup(b"__modinit__").unwrap()))(); + (mem::transmute::(__modinit__))(); send(&NowSave(NOW)); - attribute_writeback(library.lookup(b"typeinfo").unwrap_or(0) as *const ()); + if let Some(typeinfo) = typeinfo { + attribute_writeback(typeinfo as *const ()); + } send(&RunFinished); diff --git a/artiq/firmware/libdyld/lib.rs b/artiq/firmware/libdyld/lib.rs index a331bf423..8fe1c6c25 100644 --- a/artiq/firmware/libdyld/lib.rs +++ b/artiq/firmware/libdyld/lib.rs @@ -81,7 +81,6 @@ pub struct Library<'a> { image_sz: usize, strtab: &'a [u8], symtab: &'a [Elf32_Sym], - rela: &'a [Elf32_Rela], pltrel: &'a [Elf32_Rela], hash_bucket: &'a [Elf32_Word], hash_chain: &'a [Elf32_Word], @@ -132,8 +131,9 @@ impl<'a> Library<'a> { Ok(unsafe { *ptr = value }) } - pub fn rebind(&self, name: &[u8], addr: Elf32_Word) -> Result<(), Error<'a>> { - for rela in self.rela.iter().chain(self.pltrel.iter()) { + // This is unsafe because it mutates global data (the PLT). + pub unsafe fn rebind(&self, name: &[u8], addr: Elf32_Word) -> Result<(), Error<'a>> { + for rela in self.pltrel.iter() { match ELF32_R_TYPE(rela.r_info) { R_OR1K_32 | R_OR1K_GLOB_DAT | R_OR1K_JMP_SLOT => { let sym = self.symtab.get(ELF32_R_SYM(rela.r_info) as usize) @@ -315,7 +315,6 @@ impl<'a> Library<'a> { image_sz: image.len(), strtab: strtab, symtab: symtab, - rela: rela, pltrel: pltrel, hash_bucket: &hash[..nbucket], hash_chain: &hash[nbucket..nbucket + nchain], @@ -331,9 +330,8 @@ impl<'a> Library<'a> { // we never write to the memory they refer to, so it's safe. mem::drop(image); - for r in rela.iter().chain(pltrel.iter()) { - library.resolve_rela(r, resolve)? - } + for r in rela { library.resolve_rela(r, resolve)? } + for r in pltrel { library.resolve_rela(r, resolve)? } Ok(library) } diff --git a/artiq/firmware/libproto/kernel_proto.rs b/artiq/firmware/libproto/kernel_proto.rs index 5e7238360..a1b75a8f3 100644 --- a/artiq/firmware/libproto/kernel_proto.rs +++ b/artiq/firmware/libproto/kernel_proto.rs @@ -29,6 +29,15 @@ pub enum Message<'a> { RtioInitRequest, + DmaRecordStart, + DmaRecordAppend { + timestamp: u64, + channel: u32, + address: u32, + data: &'a [u32] + }, + DmaRecordStop(&'a str), + DrtioChannelStateRequest { channel: u32 }, DrtioChannelStateReply { fifo_space: u16, last_timestamp: u64 }, DrtioResetChannelStateRequest { channel: u32 }, diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index 230545957..475c24546 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -41,6 +41,7 @@ mod rtio_mgt; mod urc; mod sched; mod cache; +mod rtio_dma; mod kernel; mod session; diff --git a/artiq/firmware/runtime/rtio_dma.rs b/artiq/firmware/runtime/rtio_dma.rs new file mode 100644 index 000000000..a0ce08350 --- /dev/null +++ b/artiq/firmware/runtime/rtio_dma.rs @@ -0,0 +1,58 @@ +use std::vec::Vec; +use std::string::String; +use std::btree_map::BTreeMap; +use std::mem; +use proto::io; + +#[derive(Debug)] +struct Entry { + data: Vec +} + +#[derive(Debug)] +pub struct Manager { + entries: BTreeMap, + recording: Vec +} + +impl Manager { + pub fn new() -> Manager { + Manager { + entries: BTreeMap::new(), + recording: Vec::new() + } + } + + pub fn record_start(&mut self) { + self.recording.clear(); + } + + pub fn record_append(&mut self, timestamp: u64, channel: u32, + address: u32, data: &[u32]) { + // See gateware/rtio/dma.py. + let length = /*length*/1 + /*channel*/3 + /*timestamp*/8 + /*address*/2 + + /*data*/data.len() * 4; + let writer = &mut self.recording; + io::write_u8(writer, length as u8).unwrap(); + io::write_u8(writer, (channel >> 24) as u8).unwrap(); + io::write_u8(writer, (channel >> 16) as u8).unwrap(); + io::write_u8(writer, (channel >> 8) as u8).unwrap(); + io::write_u64(writer, timestamp).unwrap(); + io::write_u16(writer, address as u16).unwrap(); + for &word in data { + io::write_u32(writer, word).unwrap(); + } + } + + pub fn record_stop(&mut self, name: &str) { + let mut recorded = Vec::new(); + mem::swap(&mut self.recording, &mut recorded); + recorded.shrink_to_fit(); + + info!("recorded DMA data: {:?}", recorded); + + self.entries.insert(String::from(name), Entry { + data: recorded + }); + } +} diff --git a/artiq/firmware/runtime/session.rs b/artiq/firmware/runtime/session.rs index 13652bbf7..94babe586 100644 --- a/artiq/firmware/runtime/session.rs +++ b/artiq/firmware/runtime/session.rs @@ -6,6 +6,7 @@ use std::error::Error; use {config, rtio_mgt, mailbox, rpc_queue, kernel}; use logger_artiq::BufferLogger; use cache::Cache; +use rtio_dma::Manager as DmaManager; use urc::Urc; use sched::{ThreadHandle, Io}; use sched::{TcpListener, TcpStream}; @@ -34,6 +35,7 @@ fn io_error(msg: &str) -> io::Error { struct Congress { now: u64, cache: Cache, + dma_manager: DmaManager, finished_cleanly: Cell } @@ -42,6 +44,7 @@ impl Congress { Congress { now: 0, cache: Cache::new(), + dma_manager: DmaManager::new(), finished_cleanly: Cell::new(true) } } @@ -347,8 +350,7 @@ fn process_host_message(io: &Io, } } -fn process_kern_message(io: &Io, - mut stream: Option<&mut TcpStream>, +fn process_kern_message(io: &Io, mut stream: Option<&mut TcpStream>, session: &mut Session) -> io::Result { kern_recv_notrace(io, |request| { match (request, session.kernel_state) { @@ -394,6 +396,19 @@ fn process_kern_message(io: &Io, kern_acknowledge() } + &kern::DmaRecordStart => { + session.congress.dma_manager.record_start(); + kern_acknowledge() + } + &kern::DmaRecordAppend { timestamp, channel, address, data } => { + session.congress.dma_manager.record_append(timestamp, channel, address, data); + kern_acknowledge() + } + &kern::DmaRecordStop(name) => { + session.congress.dma_manager.record_stop(name); + kern_acknowledge() + } + &kern::DrtioChannelStateRequest { channel } => { let (fifo_space, last_timestamp) = rtio_mgt::drtio_dbg::get_channel_state(channel); kern_send(io, &kern::DrtioChannelStateReply { fifo_space: fifo_space, diff --git a/doc/manual/core_drivers_reference.rst b/doc/manual/core_drivers_reference.rst index adec438e1..6def86ae8 100644 --- a/doc/manual/core_drivers_reference.rst +++ b/doc/manual/core_drivers_reference.rst @@ -21,6 +21,12 @@ These drivers are for the core device and the peripherals closely integrated int .. automodule:: artiq.coredevice.dds :members: +:mod:`artiq.coredevice.dma` module +---------------------------------- + +.. automodule:: artiq.coredevice.dma + :members: + :mod:`artiq.coredevice.spi` module ----------------------------------