Skip to content

Commit 8ccfe66

Browse files
committed
ARC: split elf.h into uapi and export it for userspace
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 1713905 commit 8ccfe66

File tree

3 files changed

+38
-26
lines changed

3 files changed

+38
-26
lines changed

arch/arc/include/asm/elf.h

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,27 @@
99
#ifndef __ASM_ARC_ELF_H
1010
#define __ASM_ARC_ELF_H
1111

12-
#include <asm/ptrace.h>
12+
#include <linux/types.h>
13+
#include <uapi/asm/elf.h>
1314

15+
/* These ELF defines belong to uapi but libc elf.h already defines them */
1416
#define EM_ARCOMPACT 93
1517

16-
/* Machine specific ELF Hdr flags */
17-
#define EF_ARC_OSABI_MSK 0x00000f00
18-
#define EF_ARC_OSABI_ORIG 0x00000000 /* MUST be zero for back-compat */
19-
#define EF_ARC_OSABI_CURRENT 0x00000300 /* v3 (no legacy syscalls) */
20-
2118
/* ARC Relocations (kernel Modules only) */
2219
#define R_ARC_32 0x4
2320
#define R_ARC_32_ME 0x1B
2421
#define R_ARC_S25H_PCREL 0x10
2522
#define R_ARC_S25W_PCREL 0x11
2623

27-
typedef unsigned long elf_greg_t;
28-
typedef unsigned long elf_fpregset_t;
24+
/*to set parameters in the core dumps */
25+
#define ELF_ARCH EM_ARCOMPACT
26+
#define ELF_CLASS ELFCLASS32
2927

30-
#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
31-
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
28+
#ifdef CONFIG_CPU_BIG_ENDIAN
29+
#define ELF_DATA ELFDATA2MSB
30+
#else
31+
#define ELF_DATA ELFDATA2LSB
32+
#endif
3233

3334
/*
3435
* To ensure that
@@ -39,20 +40,6 @@ struct elf32_hdr;
3940
extern int elf_check_arch(const struct elf32_hdr *);
4041
#define elf_check_arch elf_check_arch
4142

42-
/*
43-
* These are used to set parameters in the core dumps.
44-
*/
45-
#define ELF_ARCH EM_ARCOMPACT
46-
#define ELF_CLASS ELFCLASS32
47-
48-
#ifdef CONFIG_CPU_BIG_ENDIAN
49-
#define ELF_DATA ELFDATA2MSB
50-
#else
51-
#define ELF_DATA ELFDATA2LSB
52-
#endif
53-
54-
#ifdef __KERNEL__
55-
5643
#define CORE_DUMP_USE_REGSET
5744

5845
#define ELF_EXEC_PAGESIZE PAGE_SIZE
@@ -88,6 +75,4 @@ extern int elf_check_arch(const struct elf32_hdr *);
8875
#define SET_PERSONALITY(ex) \
8976
set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
9077

91-
#endif /* __KERNEL__ */
92-
9378
#endif

arch/arc/include/uapi/asm/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# UAPI Header export list
22
include include/uapi/asm-generic/Kbuild.asm
3+
header-y += elf.h
34
header-y += page.h
45
header-y += setup.h
56
header-y += byteorder.h

arch/arc/include/uapi/asm/elf.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
7+
*/
8+
9+
#ifndef _UAPI__ASM_ARC_ELF_H
10+
#define _UAPI__ASM_ARC_ELF_H
11+
12+
#include <asm/ptrace.h> /* for user_regs_struct */
13+
14+
/* Machine specific ELF Hdr flags */
15+
#define EF_ARC_OSABI_MSK 0x00000f00
16+
#define EF_ARC_OSABI_ORIG 0x00000000 /* MUST be zero for back-compat */
17+
#define EF_ARC_OSABI_CURRENT 0x00000300 /* v3 (no legacy syscalls) */
18+
19+
typedef unsigned long elf_greg_t;
20+
typedef unsigned long elf_fpregset_t;
21+
22+
#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
23+
24+
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
25+
26+
#endif

0 commit comments

Comments
 (0)