@@ -27,17 +27,25 @@ pub type Elf32_Half = u16;
2727pub type Elf32_Word = u32 ;
2828pub type Elf32_Off = u32 ;
2929pub type Elf32_Addr = u32 ;
30+ pub type Elf32_Xword = u64 ;
31+ pub type Elf32_Sword = i32 ;
3032
3133pub type Elf64_Half = u16 ;
3234pub type Elf64_Word = u32 ;
3335pub type Elf64_Off = u64 ;
3436pub type Elf64_Addr = u64 ;
3537pub type Elf64_Xword = u64 ;
3638pub type Elf64_Sxword = i64 ;
39+ pub type Elf64_Sword = i32 ;
3740
3841pub type Elf32_Section = u16 ;
3942pub type Elf64_Section = u16 ;
4043
44+ pub type Elf32_Relr = Elf32_Word ;
45+ pub type Elf64_Relr = Elf32_Xword ;
46+ pub type Elf32_Rel = __c_anonymous_elf32_rel ;
47+ pub type Elf64_Rel = __c_anonymous_elf64_rel ;
48+
4149// linux/can.h
4250pub type canid_t = u32 ;
4351
@@ -564,6 +572,16 @@ s! {
564572 pub sh_entsize: Elf64_Xword ,
565573 }
566574
575+ pub struct __c_anonymous_elf32_rel {
576+ pub r_offset: Elf32_Addr ,
577+ pub r_info: Elf32_Word ,
578+ }
579+
580+ pub struct __c_anonymous_elf64_rel {
581+ pub r_offset: Elf64_Addr ,
582+ pub r_info: Elf64_Xword ,
583+ }
584+
567585 pub struct ucred {
568586 pub pid: :: pid_t,
569587 pub uid: :: uid_t,
@@ -997,6 +1015,8 @@ s! {
9971015
9981016cfg_if ! {
9991017 if #[ cfg( not( target_arch = "sparc64" ) ) ] {
1018+ pub type Elf32_Rela = __c_anonymous_elf32_rela;
1019+ pub type Elf64_Rela = __c_anonymous_elf64_rela;
10001020 s!{
10011021 pub struct iw_thrspy {
10021022 pub addr: :: sockaddr,
@@ -1014,6 +1034,17 @@ cfg_if! {
10141034 pub src_addr: :: sockaddr,
10151035 pub tsc: [ __u8; IW_ENCODE_SEQ_MAX_SIZE ] ,
10161036 }
1037+ pub struct __c_anonymous_elf32_rela {
1038+ pub r_offset: Elf32_Addr ,
1039+ pub r_info: Elf32_Word ,
1040+ pub r_addend: Elf32_Sword ,
1041+ }
1042+
1043+ pub struct __c_anonymous_elf64_rela {
1044+ pub r_offset: Elf64_Addr ,
1045+ pub r_info: Elf64_Xword ,
1046+ pub r_addend: Elf64_Sxword ,
1047+ }
10171048 }
10181049 }
10191050}
@@ -5214,6 +5245,30 @@ f! {
52145245 pub fn BPF_JUMP ( code: :: __u16, k: :: __u32, jt: :: __u8, jf: :: __u8) -> sock_filter {
52155246 sock_filter{ code: code, jt: jt, jf: jf, k: k}
52165247 }
5248+
5249+ pub fn ELF32_R_SYM ( val: Elf32_Word ) -> Elf32_Word {
5250+ val >> 8
5251+ }
5252+
5253+ pub fn ELF32_R_TYPE ( val: Elf32_Word ) -> Elf32_Word {
5254+ val & 0xff
5255+ }
5256+
5257+ pub fn ELF32_R_INFO ( sym: Elf32_Word , t: Elf32_Word ) -> Elf32_Word {
5258+ sym << 8 + t & 0xff
5259+ }
5260+
5261+ pub fn ELF64_R_SYM ( val: Elf64_Xword ) -> Elf64_Xword {
5262+ val >> 32
5263+ }
5264+
5265+ pub fn ELF64_R_TYPE ( val: Elf64_Xword ) -> Elf64_Xword {
5266+ val & 0xffffffff
5267+ }
5268+
5269+ pub fn ELF64_R_INFO ( sym: Elf64_Xword , t: Elf64_Xword ) -> Elf64_Xword {
5270+ sym << 32 + t
5271+ }
52175272}
52185273
52195274safe_f ! {
0 commit comments