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