@@ -78,6 +78,7 @@ impl Object {
7878 Architecture :: Bpf => false ,
7979 Architecture :: I386 => false ,
8080 Architecture :: X86_64 => true ,
81+ Architecture :: X86_64_X32 => true ,
8182 Architecture :: Hexagon => true ,
8283 Architecture :: Mips => false ,
8384 Architecture :: Mips64 => true ,
@@ -360,6 +361,7 @@ impl Object {
360361 Architecture :: Bpf => elf:: EM_BPF ,
361362 Architecture :: I386 => elf:: EM_386 ,
362363 Architecture :: X86_64 => elf:: EM_X86_64 ,
364+ Architecture :: X86_64_X32 => elf:: EM_X86_64 ,
363365 Architecture :: Hexagon => elf:: EM_HEXAGON ,
364366 Architecture :: Mips => elf:: EM_MIPS ,
365367 Architecture :: Mips64 => elf:: EM_MIPS ,
@@ -639,29 +641,34 @@ impl Object {
639641 return Err ( Error ( format ! ( "unimplemented relocation {:?}" , reloc) ) ) ;
640642 }
641643 } ,
642- Architecture :: X86_64 => match ( reloc. kind , reloc. encoding , reloc. size ) {
643- ( RelocationKind :: Absolute , RelocationEncoding :: Generic , 64 ) => {
644- elf:: R_X86_64_64
645- }
646- ( RelocationKind :: Relative , _, 32 ) => elf:: R_X86_64_PC32 ,
647- ( RelocationKind :: Got , _, 32 ) => elf:: R_X86_64_GOT32 ,
648- ( RelocationKind :: PltRelative , _, 32 ) => elf:: R_X86_64_PLT32 ,
649- ( RelocationKind :: GotRelative , _, 32 ) => elf:: R_X86_64_GOTPCREL ,
650- ( RelocationKind :: Absolute , RelocationEncoding :: Generic , 32 ) => {
651- elf:: R_X86_64_32
652- }
653- ( RelocationKind :: Absolute , RelocationEncoding :: X86Signed , 32 ) => {
654- elf:: R_X86_64_32S
655- }
656- ( RelocationKind :: Absolute , _, 16 ) => elf:: R_X86_64_16 ,
657- ( RelocationKind :: Relative , _, 16 ) => elf:: R_X86_64_PC16 ,
658- ( RelocationKind :: Absolute , _, 8 ) => elf:: R_X86_64_8 ,
659- ( RelocationKind :: Relative , _, 8 ) => elf:: R_X86_64_PC8 ,
660- ( RelocationKind :: Elf ( x) , _, _) => x,
661- _ => {
662- return Err ( Error ( format ! ( "unimplemented relocation {:?}" , reloc) ) ) ;
644+ Architecture :: X86_64 | Architecture :: X86_64_X32 => {
645+ match ( reloc. kind , reloc. encoding , reloc. size ) {
646+ ( RelocationKind :: Absolute , RelocationEncoding :: Generic , 64 ) => {
647+ elf:: R_X86_64_64
648+ }
649+ ( RelocationKind :: Relative , _, 32 ) => elf:: R_X86_64_PC32 ,
650+ ( RelocationKind :: Got , _, 32 ) => elf:: R_X86_64_GOT32 ,
651+ ( RelocationKind :: PltRelative , _, 32 ) => elf:: R_X86_64_PLT32 ,
652+ ( RelocationKind :: GotRelative , _, 32 ) => elf:: R_X86_64_GOTPCREL ,
653+ ( RelocationKind :: Absolute , RelocationEncoding :: Generic , 32 ) => {
654+ elf:: R_X86_64_32
655+ }
656+ ( RelocationKind :: Absolute , RelocationEncoding :: X86Signed , 32 ) => {
657+ elf:: R_X86_64_32S
658+ }
659+ ( RelocationKind :: Absolute , _, 16 ) => elf:: R_X86_64_16 ,
660+ ( RelocationKind :: Relative , _, 16 ) => elf:: R_X86_64_PC16 ,
661+ ( RelocationKind :: Absolute , _, 8 ) => elf:: R_X86_64_8 ,
662+ ( RelocationKind :: Relative , _, 8 ) => elf:: R_X86_64_PC8 ,
663+ ( RelocationKind :: Elf ( x) , _, _) => x,
664+ _ => {
665+ return Err ( Error ( format ! (
666+ "unimplemented relocation {:?}" ,
667+ reloc
668+ ) ) ) ;
669+ }
663670 }
664- } ,
671+ }
665672 Architecture :: Hexagon => match ( reloc. kind , reloc. encoding , reloc. size ) {
666673 ( RelocationKind :: Absolute , _, 32 ) => elf:: R_HEX_32 ,
667674 ( RelocationKind :: Elf ( x) , _, _) => x,
0 commit comments