xref: /openbmc/linux/arch/mips/boot/tools/relocs_64.c (revision b2441318)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2766c5803SMatt Redfearn #include "relocs.h"
3766c5803SMatt Redfearn 
4766c5803SMatt Redfearn #define ELF_BITS 64
5766c5803SMatt Redfearn 
6766c5803SMatt Redfearn #define ELF_MACHINE             EM_MIPS
7766c5803SMatt Redfearn #define ELF_MACHINE_NAME        "MIPS64"
8766c5803SMatt Redfearn #define SHT_REL_TYPE            SHT_RELA
9766c5803SMatt Redfearn #define Elf_Rel                 Elf64_Rela
10766c5803SMatt Redfearn 
11766c5803SMatt Redfearn typedef uint8_t Elf64_Byte;
12766c5803SMatt Redfearn 
13828a5428SHarvey Hunt typedef union {
14828a5428SHarvey Hunt 	struct {
15766c5803SMatt Redfearn 		Elf64_Word r_sym;	/* Symbol index.  */
16766c5803SMatt Redfearn 		Elf64_Byte r_ssym;	/* Special symbol.  */
17766c5803SMatt Redfearn 		Elf64_Byte r_type3;	/* Third relocation.  */
18766c5803SMatt Redfearn 		Elf64_Byte r_type2;	/* Second relocation.  */
19766c5803SMatt Redfearn 		Elf64_Byte r_type;	/* First relocation.  */
20828a5428SHarvey Hunt 	} fields;
21828a5428SHarvey Hunt 	Elf64_Xword unused;
22766c5803SMatt Redfearn } Elf64_Mips_Rela;
23766c5803SMatt Redfearn 
24766c5803SMatt Redfearn #define ELF_CLASS               ELFCLASS64
25828a5428SHarvey Hunt #define ELF_R_SYM(val)          (((Elf64_Mips_Rela *)(&val))->fields.r_sym)
26828a5428SHarvey Hunt #define ELF_R_TYPE(val)         (((Elf64_Mips_Rela *)(&val))->fields.r_type)
27766c5803SMatt Redfearn #define ELF_ST_TYPE(o)          ELF64_ST_TYPE(o)
28766c5803SMatt Redfearn #define ELF_ST_BIND(o)          ELF64_ST_BIND(o)
29766c5803SMatt Redfearn #define ELF_ST_VISIBILITY(o)    ELF64_ST_VISIBILITY(o)
30766c5803SMatt Redfearn 
31766c5803SMatt Redfearn #include "relocs.c"
32