xref: /openbmc/linux/arch/mips/boot/tools/relocs_64.c (revision 828a54287c09fea6cd2102b7764d9a10f50bc44d)
1766c5803SMatt Redfearn #include "relocs.h"
2766c5803SMatt Redfearn 
3766c5803SMatt Redfearn #define ELF_BITS 64
4766c5803SMatt Redfearn 
5766c5803SMatt Redfearn #define ELF_MACHINE             EM_MIPS
6766c5803SMatt Redfearn #define ELF_MACHINE_NAME        "MIPS64"
7766c5803SMatt Redfearn #define SHT_REL_TYPE            SHT_RELA
8766c5803SMatt Redfearn #define Elf_Rel                 Elf64_Rela
9766c5803SMatt Redfearn 
10766c5803SMatt Redfearn typedef uint8_t Elf64_Byte;
11766c5803SMatt Redfearn 
12*828a5428SHarvey Hunt typedef union {
13*828a5428SHarvey Hunt 	struct {
14766c5803SMatt Redfearn 		Elf64_Word r_sym;	/* Symbol index.  */
15766c5803SMatt Redfearn 		Elf64_Byte r_ssym;	/* Special symbol.  */
16766c5803SMatt Redfearn 		Elf64_Byte r_type3;	/* Third relocation.  */
17766c5803SMatt Redfearn 		Elf64_Byte r_type2;	/* Second relocation.  */
18766c5803SMatt Redfearn 		Elf64_Byte r_type;	/* First relocation.  */
19*828a5428SHarvey Hunt 	} fields;
20*828a5428SHarvey Hunt 	Elf64_Xword unused;
21766c5803SMatt Redfearn } Elf64_Mips_Rela;
22766c5803SMatt Redfearn 
23766c5803SMatt Redfearn #define ELF_CLASS               ELFCLASS64
24*828a5428SHarvey Hunt #define ELF_R_SYM(val)          (((Elf64_Mips_Rela *)(&val))->fields.r_sym)
25*828a5428SHarvey Hunt #define ELF_R_TYPE(val)         (((Elf64_Mips_Rela *)(&val))->fields.r_type)
26766c5803SMatt Redfearn #define ELF_ST_TYPE(o)          ELF64_ST_TYPE(o)
27766c5803SMatt Redfearn #define ELF_ST_BIND(o)          ELF64_ST_BIND(o)
28766c5803SMatt Redfearn #define ELF_ST_VISIBILITY(o)    ELF64_ST_VISIBILITY(o)
29766c5803SMatt Redfearn 
30766c5803SMatt Redfearn #include "relocs.c"
31