@@ -28,17 +28,32 @@ pub type Elf32_Half = u16;
28
28
pub type Elf32_Word = u32 ;
29
29
pub type Elf32_Off = u32 ;
30
30
pub type Elf32_Addr = u32 ;
31
+ pub type Elf32_Xword = u64 ;
32
+ pub type Elf32_Sword = i32 ;
31
33
32
34
pub type Elf64_Half = u16 ;
33
35
pub type Elf64_Word = u32 ;
34
36
pub type Elf64_Off = u64 ;
35
37
pub type Elf64_Addr = u64 ;
36
38
pub type Elf64_Xword = u64 ;
37
39
pub type Elf64_Sxword = i64 ;
40
+ pub type Elf64_Sword = i32 ;
38
41
39
42
pub type Elf32_Section = u16 ;
40
43
pub type Elf64_Section = u16 ;
41
44
45
+ pub type Elf32_Relr = Elf32_Word ;
46
+ pub type Elf64_Relr = Elf32_Xword ;
47
+ pub type Elf32_Rel = __c_anonymous_elf32_rel ;
48
+ pub type Elf64_Rel = __c_anonymous_elf64_rel ;
49
+
50
+ cfg_if ! {
51
+ if #[ cfg( not( target_arch = "sparc64" ) ) ] {
52
+ pub type Elf32_Rela = __c_anonymous_elf32_rela;
53
+ pub type Elf64_Rela = __c_anonymous_elf64_rela;
54
+ }
55
+ }
56
+
42
57
// linux/can.h
43
58
pub type canid_t = u32 ;
44
59
@@ -980,6 +995,24 @@ s! {
980
995
}
981
996
}
982
997
998
+ cfg_if ! {
999
+ if #[ cfg( not( target_arch = "sparc64" ) ) ] {
1000
+ s!{
1001
+ pub struct __c_anonymous_elf32_rela {
1002
+ pub r_offset: Elf32_Addr ,
1003
+ pub r_info: Elf32_Word ,
1004
+ pub r_addend: Elf32_Sword ,
1005
+ }
1006
+
1007
+ pub struct __c_anonymous_elf64_rela {
1008
+ pub r_offset: Elf64_Addr ,
1009
+ pub r_info: Elf64_Xword ,
1010
+ pub r_addend: Elf64_Sxword ,
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+
983
1016
s_no_extra_traits ! {
984
1017
pub struct sockaddr_nl {
985
1018
pub nl_family: :: sa_family_t,
@@ -5353,6 +5386,30 @@ f! {
5353
5386
pub fn BPF_JUMP ( code: :: __u16, k: :: __u32, jt: :: __u8, jf: :: __u8) -> sock_filter {
5354
5387
sock_filter{ code: code, jt: jt, jf: jf, k: k}
5355
5388
}
5389
+
5390
+ pub fn ELF32_R_SYM ( val: Elf32_Word ) -> Elf32_Word {
5391
+ val >> 8
5392
+ }
5393
+
5394
+ pub fn ELF32_R_TYPE ( val: Elf32_Word ) -> Elf32_Word {
5395
+ val & 0xff
5396
+ }
5397
+
5398
+ pub fn ELF32_R_INFO ( sym: Elf32_Word , t: Elf32_Word ) -> Elf32_Word {
5399
+ sym << 8 + t & 0xff
5400
+ }
5401
+
5402
+ pub fn ELF64_R_SYM ( val: Elf64_Xword ) -> Elf64_Xword {
5403
+ val >> 32
5404
+ }
5405
+
5406
+ pub fn ELF64_R_TYPE ( val: Elf64_Xword ) -> Elf64_Xword {
5407
+ val & 0xffffffff
5408
+ }
5409
+
5410
+ pub fn ELF64_R_INFO ( sym: Elf64_Xword , t: Elf64_Xword ) -> Elf64_Xword {
5411
+ sym << 32 + t
5412
+ }
5356
5413
}
5357
5414
5358
5415
safe_f ! {
0 commit comments