xref: /OK3568_Linux_fs/kernel/arch/arc/include/asm/elf.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #ifndef __ASM_ARC_ELF_H
7*4882a593Smuzhiyun #define __ASM_ARC_ELF_H
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <linux/types.h>
10*4882a593Smuzhiyun #include <linux/elf-em.h>
11*4882a593Smuzhiyun #include <uapi/asm/elf.h>
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #define EM_ARC_INUSE		(IS_ENABLED(CONFIG_ISA_ARCOMPACT) ? \
14*4882a593Smuzhiyun 					EM_ARCOMPACT : EM_ARCV2)
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /* ARC Relocations (kernel Modules only) */
17*4882a593Smuzhiyun #define  R_ARC_32		0x4
18*4882a593Smuzhiyun #define  R_ARC_32_ME		0x1B
19*4882a593Smuzhiyun #define  R_ARC_32_PCREL		0x31
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /*to set parameters in the core dumps */
22*4882a593Smuzhiyun #define ELF_ARCH		EM_ARC_INUSE
23*4882a593Smuzhiyun #define ELF_CLASS		ELFCLASS32
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #ifdef CONFIG_CPU_BIG_ENDIAN
26*4882a593Smuzhiyun #define ELF_DATA		ELFDATA2MSB
27*4882a593Smuzhiyun #else
28*4882a593Smuzhiyun #define ELF_DATA		ELFDATA2LSB
29*4882a593Smuzhiyun #endif
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun /*
32*4882a593Smuzhiyun  * To ensure that
33*4882a593Smuzhiyun  *  -we don't load something for the wrong architecture.
34*4882a593Smuzhiyun  *  -The userspace is using the correct syscall ABI
35*4882a593Smuzhiyun  */
36*4882a593Smuzhiyun struct elf32_hdr;
37*4882a593Smuzhiyun extern int elf_check_arch(const struct elf32_hdr *);
38*4882a593Smuzhiyun #define elf_check_arch	elf_check_arch
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun #define CORE_DUMP_USE_REGSET
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #define ELF_EXEC_PAGESIZE	PAGE_SIZE
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun /*
45*4882a593Smuzhiyun  * This is the location that an ET_DYN program is loaded if exec'ed.  Typical
46*4882a593Smuzhiyun  * use of this is to invoke "./ld.so someprog" to test out a new version of
47*4882a593Smuzhiyun  * the loader.  We need to make sure that it is out of the way of the program
48*4882a593Smuzhiyun  * that it will "exec", and that there is sufficient room for the brk.
49*4882a593Smuzhiyun  */
50*4882a593Smuzhiyun #define ELF_ET_DYN_BASE		(2UL * TASK_SIZE / 3)
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun /*
53*4882a593Smuzhiyun  * When the program starts, a1 contains a pointer to a function to be
54*4882a593Smuzhiyun  * registered with atexit, as per the SVR4 ABI.  A value of 0 means we
55*4882a593Smuzhiyun  * have no such handler.
56*4882a593Smuzhiyun  */
57*4882a593Smuzhiyun #define ELF_PLAT_INIT(_r, load_addr)	((_r)->r0 = 0)
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun /*
60*4882a593Smuzhiyun  * This yields a mask that user programs can use to figure out what
61*4882a593Smuzhiyun  * instruction set this cpu supports.
62*4882a593Smuzhiyun  */
63*4882a593Smuzhiyun #define ELF_HWCAP	(0)
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun /*
66*4882a593Smuzhiyun  * This yields a string that ld.so will use to load implementation
67*4882a593Smuzhiyun  * specific libraries for optimization.  This is more specific in
68*4882a593Smuzhiyun  * intent than poking at uname or /proc/cpuinfo.
69*4882a593Smuzhiyun  */
70*4882a593Smuzhiyun #define ELF_PLATFORM	(NULL)
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun #endif
73