1/* Score ELF support for BFD.
2   Copyright 2006 Free Software Foundation, Inc.
3   Contributed by
4   Mei Ligang (ligang@sunnorth.com.cn)
5   Pei-Lin Tsai (pltsai@sunplus.com)
6
7   This file is part of BFD, the Binary File Descriptor library.
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software Foundation,
21   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
22
23#ifndef _ELF_SCORE_H
24#define _ELF_SCORE_H
25
26#include "elf/reloc-macros.h"
27
28#define SCORE_SIMULATOR_ACTIVE  1
29#define OPC_PTMASK              0xc0000000      /* Parity-bit Mask.  */
30#define OPC16_PTMASK		0x00008000
31/* The parity-bit denotes.  */
32#define OPC_32                  0xc0000000      /* Denotes 32b instruction, (default).  */
33#define OPC_16                  0x00000000      /* Denotes 16b instruction.  */
34#define OPC_PE                  0x8000          /* Denotes parallel-execution instructions.  */
35#define GP_DISP_LABEL           "_gp_disp"
36
37/* Processor specific flags for the ELF header e_flags field:  */
38
39/* File contains position independent code.  */
40#define EF_SCORE_PIC            0x80000000
41
42/* Fix data dependency.  */
43#define EF_SCORE_FIXDEP         0x40000000
44
45/* Defined and allocated common symbol.  Value is virtual address.  If
46   relocated, alignment must be preserved.  */
47#define SHN_SCORE_TEXT		0xff01
48#define SHN_SCORE_DATA		0xff02
49/* Small common symbol.  */
50#define SHN_SCORE_SCOMMON	0xff03
51
52/* Processor specific section flags.  */
53
54/* This section must be in the global data area.  */
55#define SHF_SCORE_GPREL		0x10000000
56
57/* This section should be merged.  */
58#define SHF_SCORE_MERGE		0x20000000
59
60/* This section contains address data of size implied by section
61   element size.  */
62#define SHF_SCORE_ADDR		0x40000000
63
64/* This section contains string data.  */
65#define SHF_SCORE_STRING		0x80000000
66
67/* This section may not be stripped.  */
68#define SHF_SCORE_NOSTRIP	0x08000000
69
70/* This section is local to threads.  */
71#define SHF_SCORE_LOCAL		0x04000000
72
73/* Linker should generate implicit weak names for this section.  */
74#define SHF_SCORE_NAMES		0x02000000
75
76/* Section contais text/data which may be replicated in other sections.
77   Linker should retain only one copy.  */
78#define SHF_SCORE_NODUPES	0x01000000
79
80/* Processor specific dynamic array tags.  */
81
82/* Base address of the segment.  */
83#define DT_SCORE_BASE_ADDRESS	0x70000001
84/* Number of local global offset table entries.  */
85#define DT_SCORE_LOCAL_GOTNO	0x70000002
86/* Number of entries in the .dynsym section.  */
87#define DT_SCORE_SYMTABNO	0x70000003
88/* Index of first dynamic symbol in global offset table.  */
89#define DT_SCORE_GOTSYM		0x70000004
90/* Index of first external dynamic symbol not referenced locally.  */
91#define DT_SCORE_UNREFEXTNO	0x70000005
92/* Number of page table entries in global offset table.  */
93#define DT_SCORE_HIPAGENO	0x70000006
94
95
96/* Processor specific section types.  */
97
98
99/* Relocation types.  */
100START_RELOC_NUMBERS (elf_score_reloc_type)
101  RELOC_NUMBER (R_SCORE_NONE,           0)
102  RELOC_NUMBER (R_SCORE_HI16,           1)
103  RELOC_NUMBER (R_SCORE_LO16,           2)
104  RELOC_NUMBER (R_SCORE_DUMMY1,         3)
105  RELOC_NUMBER (R_SCORE_24,             4)
106  RELOC_NUMBER (R_SCORE_PC19,           5)
107  RELOC_NUMBER (R_SCORE16_11,           6)
108  RELOC_NUMBER (R_SCORE16_PC8,          7)
109  RELOC_NUMBER (R_SCORE_ABS32,          8)
110  RELOC_NUMBER (R_SCORE_ABS16,          9)
111  RELOC_NUMBER (R_SCORE_DUMMY2,         10)
112  RELOC_NUMBER (R_SCORE_GP15,           11)
113  RELOC_NUMBER (R_SCORE_GNU_VTINHERIT,  12)
114  RELOC_NUMBER (R_SCORE_GNU_VTENTRY,    13)
115  RELOC_NUMBER (R_SCORE_GOT15,          14)
116  RELOC_NUMBER (R_SCORE_GOT_LO16,       15)
117  RELOC_NUMBER (R_SCORE_CALL15,         16)
118  RELOC_NUMBER (R_SCORE_GPREL32,        17)
119  RELOC_NUMBER (R_SCORE_REL32,          18)
120  RELOC_NUMBER (R_SCORE_DUMMY_HI16,     19)
121END_RELOC_NUMBERS (R_SCORE_max)
122
123#endif /* _ELF_SCORE_H */
124