2016-11-02 00:45:57 +08:00
|
|
|
/* RISC-V ELF specific backend routines.
|
2019-01-01 18:31:27 +08:00
|
|
|
Copyright (C) 2011-2019 Free Software Foundation, Inc.
|
2016-11-02 00:45:57 +08:00
|
|
|
|
|
|
|
Contributed by Andrew Waterman (andrew@sifive.com).
|
|
|
|
Based on MIPS target.
|
|
|
|
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING3. If not,
|
|
|
|
see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "elf/common.h"
|
|
|
|
#include "elf/internal.h"
|
|
|
|
|
|
|
|
extern reloc_howto_type *
|
|
|
|
riscv_reloc_name_lookup (bfd *, const char *);
|
|
|
|
|
|
|
|
extern reloc_howto_type *
|
|
|
|
riscv_reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
|
|
|
|
|
|
|
|
extern reloc_howto_type *
|
unrecognized/unsupported reloc message
It must get boring translating all the variants we have of
unrecognized/unsupported/invalid/unexpected reloc number. This patch
cuts down on the number of variations.
* aoutx.h, * coff-alpha.c, * coff-i860.c, * coff-m68k.c,
* coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
* coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-w65.c,
* elf-bfd.h, * elf-m10300.c, * elf.c, * elf32-avr.c, * elf32-bfin.c,
* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-i370.c, * elf32-i386.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
* elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c,
* elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-or1k.c,
* elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-rx.c,
* elf32-s390.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c,
* elf32-xgate.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfnn-riscv.c, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-riscv.h,
* elfxx-sparc.c, * elfxx-sparc.h, * reloc.c: Standardize
unrecognized/unsupported reloc message.
2018-02-21 19:17:07 +08:00
|
|
|
riscv_elf_rtype_to_howto (bfd *, unsigned int r_type);
|
2018-12-04 05:59:44 +08:00
|
|
|
|
|
|
|
#define RISCV_DONT_CARE_VERSION -1
|
|
|
|
|
|
|
|
/* The information of architecture attribute. */
|
|
|
|
struct riscv_subset_t
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int major_version;
|
|
|
|
int minor_version;
|
|
|
|
struct riscv_subset_t *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct riscv_subset_t riscv_subset_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
riscv_subset_t *head;
|
|
|
|
riscv_subset_t *tail;
|
|
|
|
} riscv_subset_list_t;
|
|
|
|
|
|
|
|
extern void
|
|
|
|
riscv_release_subset_list (riscv_subset_list_t *);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
riscv_add_subset (riscv_subset_list_t *,
|
|
|
|
const char *,
|
|
|
|
int, int);
|
|
|
|
|
|
|
|
extern riscv_subset_t *
|
|
|
|
riscv_lookup_subset (const riscv_subset_list_t *,
|
|
|
|
const char *);
|
|
|
|
|
|
|
|
extern riscv_subset_t *
|
|
|
|
riscv_lookup_subset_version (const riscv_subset_list_t *,
|
|
|
|
const char *,
|
|
|
|
int, int);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
riscv_subset_list_t *subset_list;
|
|
|
|
void (*error_handler) (const char *,
|
|
|
|
...) ATTRIBUTE_PRINTF_1;
|
|
|
|
unsigned *xlen;
|
|
|
|
} riscv_parse_subset_t;
|
|
|
|
|
|
|
|
extern bfd_boolean
|
|
|
|
riscv_parse_subset (riscv_parse_subset_t *,
|
|
|
|
const char *);
|
|
|
|
|
|
|
|
extern const char *
|
|
|
|
riscv_supported_std_ext (void);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
riscv_release_subset_list (riscv_subset_list_t *);
|