aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-03-14 16:46:33 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-03-14 16:46:33 -0700
commit0053d10a76e5c10584bb4ac63eb7485896b22626 (patch)
treef54f9bee760bbddb02f231499cbc3ff471adc56a
parentdedbf076ad457fd084e43c54bf94d3fd27293563 (diff)
downloadriscv-gnu-toolchain-0053d10a76e5c10584bb4ac63eb7485896b22626.zip
riscv-gnu-toolchain-0053d10a76e5c10584bb4ac63eb7485896b22626.tar.gz
riscv-gnu-toolchain-0053d10a76e5c10584bb4ac63eb7485896b22626.tar.bz2
Upgrade to binutils 2.26
-rw-r--r--Makefile.in2
-rw-r--r--binutils/bfd/elfnn-riscv.c78
-rw-r--r--binutils/gas/config/tc-riscv.h2
-rw-r--r--binutils/ld/emulparams/elf32lriscv-defs.sh7
-rw-r--r--binutils/ld/emultempl/riscvelf.em2
-rw-r--r--patches/binutils194
6 files changed, 141 insertions, 144 deletions
diff --git a/Makefile.in b/Makefile.in
index d40a89f..6a5cfdd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -4,7 +4,7 @@ INSTALL_DIR := @prefix@
PACKAGES := binutils gcc glibc newlib
gcc_version := 5.3.0
-binutils_version := 2.25.1
+binutils_version := 2.26
glibc_version := 2.23
newlib_version := 2.2.0
diff --git a/binutils/bfd/elfnn-riscv.c b/binutils/bfd/elfnn-riscv.c
index 06f1895..e6f8c20 100644
--- a/binutils/bfd/elfnn-riscv.c
+++ b/binutils/bfd/elfnn-riscv.c
@@ -365,7 +365,7 @@ riscv_elf_create_dynamic_sections (bfd *dynobj,
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
htab->sdyntdata =
@@ -374,7 +374,7 @@ riscv_elf_create_dynamic_sections (bfd *dynobj,
}
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
- || (!info->shared && (!htab->srelbss || !htab->sdyntdata)))
+ || (!bfd_link_pic (info) && (!htab->srelbss || !htab->sdyntdata)))
abort ();
return TRUE;
@@ -506,7 +506,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
const Elf_Internal_Rela *rel;
asection *sreloc = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
htab = riscv_elf_hash_table (info);
@@ -555,7 +555,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
break;
case R_RISCV_TLS_GOT_HI20:
- if (info->shared)
+ if (bfd_link_pic (info))
info->flags |= DF_STATIC_TLS;
if (!riscv_elf_record_got_reference (abfd, info, h, r_symndx)
|| !riscv_elf_record_tls_type (abfd, h, r_symndx, GOT_TLS_IE))
@@ -589,19 +589,19 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_RISCV_RVC_JUMP:
case R_RISCV_PCREL_HI20:
/* In shared libraries, these relocs are known to bind locally. */
- if (info->shared)
+ if (bfd_link_pic (info))
break;
goto static_reloc;
case R_RISCV_TPREL_HI20:
- if (!info->executable)
+ if (!bfd_link_executable (info))
return bad_static_reloc (abfd, r_type, h);
if (h != NULL)
riscv_elf_record_tls_type (abfd, h, r_symndx, GOT_TLS_LE);
goto static_reloc;
case R_RISCV_HI20:
- if (info->shared)
+ if (bfd_link_pic (info))
return bad_static_reloc (abfd, r_type, h);
/* Fall through. */
@@ -617,7 +617,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (h != NULL)
h->non_got_ref = 1;
- if (h != NULL && !info->shared)
+ if (h != NULL && !bfd_link_pic (info))
{
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
@@ -645,14 +645,14 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
may need to keep relocations for symbols satisfied by a
dynamic library if we manage to avoid copy relocs for the
symbol. */
- if ((info->shared
+ if ((bfd_link_pic (info)
&& (sec->flags & SEC_ALLOC) != 0
&& (! riscv_elf_rtype_to_howto (r_type)->pc_relative
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
|| !h->def_regular))))
- || (!info->shared
+ || (!bfd_link_pic (info)
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
@@ -768,7 +768,7 @@ riscv_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (abfd);
bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
elf_section_data (sec)->local_dynrel = NULL;
@@ -829,7 +829,7 @@ riscv_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
case R_RISCV_JAL:
case R_RISCV_RVC_BRANCH:
case R_RISCV_RVC_JUMP:
- if (info->shared)
+ if (bfd_link_pic (info))
break;
/* Fall through. */
@@ -921,7 +921,7 @@ riscv_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
only references to the symbol are via the global offset table.
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
- if (info->shared)
+ if (bfd_link_pic (info))
return TRUE;
/* If there are no references to this symbol that do not use the
@@ -1008,7 +1008,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
return FALSE;
}
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
asection *s = htab->elf.splt;
@@ -1031,7 +1031,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
location in the .plt. This is required to make function
pointers compare as equal between the normal executable and
the shared library. */
- if (! info->shared
+ if (! bfd_link_pic (info)
&& !h->def_regular)
{
h->root.u.def.section = s;
@@ -1087,7 +1087,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
else
{
s->size += RISCV_ELF_WORD_BYTES;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
htab->elf.srelgot->size += sizeof (ElfNN_External_Rela);
}
}
@@ -1104,7 +1104,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
space for pc-relative relocs that have become local due to symbol
visibility changes. */
- if (info->shared)
+ if (bfd_link_pic (info))
{
if (SYMBOL_CALLS_LOCAL (info, h))
{
@@ -1220,7 +1220,7 @@ riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -1285,7 +1285,7 @@ riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
s->size += RISCV_ELF_WORD_BYTES;
if (*local_tls_type & GOT_TLS_GD)
s->size += RISCV_ELF_WORD_BYTES;
- if (info->shared
+ if (bfd_link_pic (info)
|| (*local_tls_type & (GOT_TLS_GD | GOT_TLS_IE)))
srel->size += sizeof (ElfNN_External_Rela);
}
@@ -1385,7 +1385,7 @@ riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (info->executable)
+ if (bfd_link_executable (info))
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
@@ -1785,7 +1785,7 @@ riscv_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
if (h != NULL)
@@ -1820,15 +1820,15 @@ riscv_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
case R_RISCV_GOT_HI20:
if (h != NULL)
{
- bfd_boolean dyn;
+ bfd_boolean dyn, pic;
off = h->got.offset;
BFD_ASSERT (off != (bfd_vma) -1);
dyn = elf_hash_table (info)->dynamic_sections_created;
+ pic = bfd_link_pic (info);
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h)))
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, pic, h)
+ || (pic && SYMBOL_REFERENCES_LOCAL (info, h)))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -1868,7 +1868,7 @@ riscv_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
off &= ~1;
else
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
@@ -1922,7 +1922,7 @@ riscv_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
case R_RISCV_CALL:
case R_RISCV_JAL:
case R_RISCV_RVC_JUMP:
- if (info->shared && h != NULL && h->plt.offset != MINUS_ONE)
+ if (bfd_link_pic (info) && h != NULL && h->plt.offset != MINUS_ONE)
{
/* Refer to the PLT entry. */
relocation = sec_addr (htab->elf.splt) + h->plt.offset;
@@ -1994,13 +1994,13 @@ riscv_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if ((input_section->flags & SEC_ALLOC) == 0)
break;
- if ((info->shared
+ if ((bfd_link_pic (info)
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
&& (! howto->pc_relative
|| !SYMBOL_CALLS_LOCAL (info, h)))
- || (!info->shared
+ || (!bfd_link_pic (info)
&& h != NULL
&& h->dynindx != -1
&& !h->non_got_ref
@@ -2026,7 +2026,7 @@ riscv_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (skip_dynamic_relocation)
memset (&outrel, 0, sizeof outrel);
else if (h != NULL && h->dynindx != -1
- && !(info->shared
+ && !(bfd_link_pic (info)
&& SYMBOLIC_BIND (info, h)
&& h->def_regular))
{
@@ -2082,20 +2082,18 @@ riscv_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (h != NULL)
{
- bfd_boolean dyn;
+ bfd_boolean dyn, pic;
dyn = htab->elf.dynamic_sections_created;
+ pic = bfd_link_pic (info);
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- && (!info->shared
- || !SYMBOL_REFERENCES_LOCAL (info, h)))
- {
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, pic, h)
+ && (!pic || !SYMBOL_REFERENCES_LOCAL (info, h)))
indx = h->dynindx;
- }
}
/* The GOT entries have not been initialized yet. Do it
now, and emit any relocations. */
- if ((info->shared || indx != 0)
+ if ((bfd_link_pic (info) || indx != 0)
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
@@ -2334,7 +2332,7 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd,
the symbol was forced to be local because of a version file.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
- if (info->shared
+ if (bfd_link_pic (info)
&& (info->symbolic || h->dynindx == -1)
&& h->def_regular)
{
@@ -2674,7 +2672,7 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec,
foff += (foff < 0 ? -ELF_MAXPAGESIZE : ELF_MAXPAGESIZE);
/* See if this function call can be shortened. */
- if (!VALID_UJTYPE_IMM (foff) && !(!link_info->shared && near_zero))
+ if (!VALID_UJTYPE_IMM (foff) && !(!bfd_link_pic (link_info) && near_zero))
return TRUE;
/* Shorten the function call. */
@@ -2869,7 +2867,7 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec,
*again = FALSE;
- if (info->relocatable
+ if (bfd_link_relocatable (info)
|| sec->sec_flg0
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
diff --git a/binutils/gas/config/tc-riscv.h b/binutils/gas/config/tc-riscv.h
index ab6dd91..ed654ad 100644
--- a/binutils/gas/config/tc-riscv.h
+++ b/binutils/gas/config/tc-riscv.h
@@ -94,7 +94,7 @@ extern int tc_riscv_regname_to_dw2regnum (char *regname);
extern unsigned xlen;
#define DWARF2_DEFAULT_RETURN_COLUMN X_RA
-#define DWARF2_CIE_DATA_ALIGNMENT (xlen / 8)
+#define DWARF2_CIE_DATA_ALIGNMENT (-(int) (xlen / 8))
#define elf_tc_final_processing riscv_elf_final_processing
extern void riscv_elf_final_processing (void);
diff --git a/binutils/ld/emulparams/elf32lriscv-defs.sh b/binutils/ld/emulparams/elf32lriscv-defs.sh
index 24163c9..284f910 100644
--- a/binutils/ld/emulparams/elf32lriscv-defs.sh
+++ b/binutils/ld/emulparams/elf32lriscv-defs.sh
@@ -7,9 +7,10 @@ NO_REL_RELOCS=yes
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=riscvelf
-case "$EMULATION_NAME" in
-elf32*) ELFSIZE=32; LIBPATH_SUFFIX=32 ;;
-elf64*) ELFSIZE=64; LIBPATH_SUFFIX= ;;
+case x"$EMULATION_NAME" in
+xelf32*) ELFSIZE=32; LIBPATH_SUFFIX=32 ;;
+xelf64*) ELFSIZE=64; LIBPATH_SUFFIX= ;;
+x) ;;
*) echo $0: unhandled emulation $EMULATION_NAME >&2; exit 1 ;;
esac
diff --git a/binutils/ld/emultempl/riscvelf.em b/binutils/ld/emultempl/riscvelf.em
index 2f49837..de35cc1 100644
--- a/binutils/ld/emultempl/riscvelf.em
+++ b/binutils/ld/emultempl/riscvelf.em
@@ -49,7 +49,7 @@ gld${EMULATION_NAME}_after_allocation (void)
/* Don't attempt to discard unused .eh_frame sections until the final link,
as we can't reliably tell if they're used until after relaxation. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
need_layout = bfd_elf_discard_info (link_info.output_bfd, &link_info);
if (need_layout < 0)
diff --git a/patches/binutils b/patches/binutils
index 20d5b42..10867cf 100644
--- a/patches/binutils
+++ b/patches/binutils
@@ -1,6 +1,6 @@
--- original-binutils/bfd/archures.c
+++ binutils/bfd/archures.c
-@@ -597,6 +597,7 @@ extern const bfd_arch_info_type bfd_pj_a
+@@ -612,6 +612,7 @@ extern const bfd_arch_info_type bfd_pj_a
extern const bfd_arch_info_type bfd_plugin_arch;
extern const bfd_arch_info_type bfd_powerpc_archs[];
#define bfd_powerpc_arch bfd_powerpc_archs[0]
@@ -8,7 +8,7 @@
extern const bfd_arch_info_type bfd_rs6000_arch;
extern const bfd_arch_info_type bfd_rl78_arch;
extern const bfd_arch_info_type bfd_rx_arch;
-@@ -683,6 +684,7 @@ static const bfd_arch_info_type * const
+@@ -701,6 +702,7 @@ static const bfd_arch_info_type * const
&bfd_or1k_arch,
&bfd_pdp11_arch,
&bfd_powerpc_arch,
@@ -18,7 +18,7 @@
&bfd_rx_arch,
--- original-binutils/bfd/bfd-in2.h
+++ binutils/bfd/bfd-in2.h
-@@ -2043,6 +2043,9 @@ enum bfd_architecture
+@@ -2073,6 +2073,9 @@ enum bfd_architecture
#define bfd_mach_ppc_e6500 5007
#define bfd_mach_ppc_titan 83
#define bfd_mach_ppc_vle 84
@@ -28,7 +28,7 @@
bfd_arch_rs6000, /* IBM RS/6000 */
#define bfd_mach_rs6k 6000
#define bfd_mach_rs6k_rs1 6001
-@@ -5531,6 +5534,46 @@ relative offset from _GLOBAL_OFFSET_TABL
+@@ -5652,6 +5655,46 @@ relative offset from _GLOBAL_OFFSET_TABL
value in a word. The relocation is relative offset from */
BFD_RELOC_MICROBLAZE_32_GOTOFF,
@@ -77,7 +77,7 @@
BFD_RELOC_MICROBLAZE_COPY,
--- original-binutils/bfd/config.bfd
+++ binutils/bfd/config.bfd
-@@ -119,6 +119,7 @@ or1k*|or1knd*) targ_archs=bfd_or1k_arch
+@@ -120,6 +120,7 @@ or1k*|or1knd*) targ_archs=bfd_or1k_arch
pdp11*) targ_archs=bfd_pdp11_arch ;;
pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
@@ -85,7 +85,7 @@
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
s390*) targ_archs=bfd_s390_arch ;;
sh*) targ_archs=bfd_sh_arch ;;
-@@ -1319,6 +1320,18 @@ case "${targ}" in
+@@ -1344,6 +1345,18 @@ case "${targ}" in
targ_defvec=rl78_elf32_vec
;;
@@ -106,29 +106,29 @@
targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec rx_elf32_be_ns_vec"
--- original-binutils/bfd/configure
+++ binutils/bfd/configure
-@@ -15506,6 +15506,8 @@ do
- powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
- powerpc_pei_le_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
- powerpc_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
+@@ -15472,6 +15472,8 @@ do
+ powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
+ powerpc_pei_le_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
+ powerpc_xcoff_vec) tb="$tb coff-rs6000.lo $xcoff" ;;
+ riscv_elf32_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf32.lo $elf" ;;
+ riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf32.lo $elf"; target_size=64 ;;
rl78_elf32_vec) tb="$tb elf32-rl78.lo elf32.lo $elf" ;;
- rs6000_xcoff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
- rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
+ rs6000_xcoff64_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
+ rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
--- original-binutils/bfd/configure.ac
+++ binutils/bfd/configure.ac
-@@ -907,6 +907,8 @@ do
- powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
- powerpc_pei_le_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
- powerpc_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
+@@ -918,6 +918,8 @@ do
+ powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
+ powerpc_pei_le_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
+ powerpc_xcoff_vec) tb="$tb coff-rs6000.lo $xcoff" ;;
+ riscv_elf32_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf32.lo $elf" ;;
+ riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf32.lo $elf"; target_size=64 ;;
rl78_elf32_vec) tb="$tb elf32-rl78.lo elf32.lo $elf" ;;
- rs6000_xcoff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
- rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
+ rs6000_xcoff64_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
+ rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
--- original-binutils/bfd/elf-bfd.h
+++ binutils/bfd/elf-bfd.h
-@@ -433,6 +433,7 @@ enum elf_target_id
+@@ -475,6 +475,7 @@ enum elf_target_id
XGATE_ELF_DATA,
TILEGX_ELF_DATA,
TILEPRO_ELF_DATA,
@@ -138,8 +138,8 @@
--- original-binutils/bfd/Makefile.am
+++ binutils/bfd/Makefile.am
-@@ -931,6 +931,18 @@ elf64-ia64.c : elfnn-ia64.c
- sed -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
+@@ -949,6 +949,18 @@ elf64-ia64.c : elfnn-ia64.c
+ $(SED) -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
mv -f elf64-ia64.new elf64-ia64.c
+elf32-riscv.c : elfnn-riscv.c
@@ -156,11 +156,27 @@
+
peigen.c : peXXigen.c
rm -f peigen.c
- sed -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
+ $(SED) -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
--- original-binutils/bfd/Makefile.in
+++ binutils/bfd/Makefile.in
-@@ -2009,6 +2009,18 @@ elf64-ia64.c : elfnn-ia64.c
- sed -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
+@@ -450,6 +450,7 @@ ALL_MACHINES = \
+ cpu-pj.lo \
+ cpu-plugin.lo \
+ cpu-powerpc.lo \
++ cpu-riscv.lo \
+ cpu-rs6000.lo \
+ cpu-rl78.lo \
+ cpu-rx.lo \
+@@ -537,6 +538,7 @@ ALL_MACHINES_CFILES = \
+ cpu-pj.c \
+ cpu-plugin.c \
+ cpu-powerpc.c \
++ cpu-riscv.c \
+ cpu-rs6000.c \
+ cpu-rl78.c \
+ cpu-rx.c \
+@@ -2035,6 +2037,18 @@ elf64-ia64.c : elfnn-ia64.c
+ $(SED) -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
mv -f elf64-ia64.new elf64-ia64.c
+elf32-riscv.c : elfnn-riscv.c
@@ -177,10 +193,10 @@
+
peigen.c : peXXigen.c
rm -f peigen.c
- sed -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
+ $(SED) -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
--- original-binutils/bfd/targets.c
+++ binutils/bfd/targets.c
-@@ -784,6 +784,8 @@ extern const bfd_target powerpc_pe_le_ve
+@@ -793,6 +793,8 @@ extern const bfd_target powerpc_pe_le_ve
extern const bfd_target powerpc_pei_vec;
extern const bfd_target powerpc_pei_le_vec;
extern const bfd_target powerpc_xcoff_vec;
@@ -191,7 +207,7 @@
extern const bfd_target rs6000_xcoff64_aix_vec;
--- original-binutils/binutils/readelf.c
+++ binutils/binutils/readelf.c
-@@ -125,6 +125,7 @@
+@@ -124,6 +124,7 @@
#include "elf/metag.h"
#include "elf/microblaze.h"
#include "elf/mips.h"
@@ -199,7 +215,7 @@
#include "elf/mmix.h"
#include "elf/mn10200.h"
#include "elf/mn10300.h"
-@@ -720,6 +721,7 @@ guess_is_rela (unsigned int e_machine)
+@@ -771,6 +772,7 @@ guess_is_rela (unsigned int e_machine)
case EM_OR1K:
case EM_PPC64:
case EM_PPC:
@@ -207,7 +223,7 @@
case EM_RL78:
case EM_RX:
case EM_S390:
-@@ -1252,6 +1254,10 @@ dump_relocations (FILE * file,
+@@ -1309,6 +1311,10 @@ dump_relocations (FILE * file,
rtype = elf_mips_reloc_type (type);
break;
@@ -218,7 +234,7 @@
case EM_ALPHA:
rtype = elf_alpha_reloc_type (type);
break;
-@@ -2164,6 +2170,7 @@ get_machine_name (unsigned e_machine)
+@@ -2250,6 +2256,7 @@ get_machine_name (unsigned e_machine)
case EM_CR16:
case EM_MICROBLAZE:
case EM_MICROBLAZE_OLD: return "Xilinx MicroBlaze";
@@ -226,7 +242,7 @@
case EM_RL78: return "Renesas RL78";
case EM_RX: return "Renesas RX";
case EM_METAG: return "Imagination Technologies Meta processor architecture";
-@@ -2951,6 +2958,13 @@ get_machine_flags (unsigned e_flags, uns
+@@ -3193,6 +3200,13 @@ get_machine_flags (unsigned e_flags, uns
decode_NDS32_machine_flags (e_flags, buf, sizeof buf);
break;
@@ -240,7 +256,7 @@
case EM_SH:
switch ((e_flags & EF_SH_MACH_MASK))
{
-@@ -10789,6 +10803,8 @@ is_32bit_abs_reloc (unsigned int reloc_t
+@@ -11430,6 +11444,8 @@ is_32bit_abs_reloc (unsigned int reloc_t
return reloc_type == 1; /* R_PPC64_ADDR32. */
case EM_PPC:
return reloc_type == 1; /* R_PPC_ADDR32. */
@@ -249,7 +265,7 @@
case EM_RL78:
return reloc_type == 1; /* R_RL78_DIR32. */
case EM_RX:
-@@ -10924,6 +10940,8 @@ is_64bit_abs_reloc (unsigned int reloc_t
+@@ -11576,6 +11592,8 @@ is_64bit_abs_reloc (unsigned int reloc_t
return reloc_type == 80; /* R_PARISC_DIR64. */
case EM_PPC64:
return reloc_type == 38; /* R_PPC64_ADDR64. */
@@ -258,28 +274,17 @@
case EM_SPARC32PLUS:
case EM_SPARCV9:
case EM_SPARC:
-@@ -11072,6 +11090,7 @@ is_none_reloc (unsigned int reloc_type)
+@@ -11730,6 +11748,7 @@ is_none_reloc (unsigned int reloc_type)
case EM_ADAPTEVA_EPIPHANY:
case EM_PPC: /* R_PPC_NONE. */
case EM_PPC64: /* R_PPC64_NONE. */
+ case EM_RISCV: /* R_RISCV_NONE. */
- case EM_ARM: /* R_ARM_NONE. */
- case EM_IA_64: /* R_IA64_NONE. */
- case EM_SH: /* R_SH_NONE. */
---- original-binutils/gas/configure.ac
-+++ binutils/gas/configure.ac
-@@ -453,7 +453,7 @@ changequote([,])dnl
- AC_MSG_RESULT($enable_audio_ext)
- ;;
-
-- i386 | s390 | sparc)
-+ i386 | riscv | s390 | sparc)
- if test $this_target = $target ; then
- AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
- fi
+ case EM_ARC: /* R_ARC_NONE. */
+ case EM_ARC_COMPACT: /* R_ARC_NONE. */
+ case EM_ARC_COMPACT2: /* R_ARC_NONE. */
--- original-binutils/gas/configure
+++ binutils/gas/configure
-@@ -12400,7 +12400,7 @@ $as_echo "#define NDS32_DEFAULT_AUDIO_EX
+@@ -12418,7 +12418,7 @@ $as_echo "#define NDS32_DEFAULT_AUDIO_EX
$as_echo "$enable_audio_ext" >&6; }
;;
@@ -288,9 +293,20 @@
if test $this_target = $target ; then
cat >>confdefs.h <<_ACEOF
+--- original-binutils/gas/configure.ac
++++ binutils/gas/configure.ac
+@@ -466,7 +466,7 @@ changequote([,])dnl
+ AC_MSG_RESULT($enable_audio_ext)
+ ;;
+
+- i386 | s390 | sparc)
++ i386 | riscv | s390 | sparc)
+ if test $this_target = $target ; then
+ AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
+ fi
--- original-binutils/gas/configure.tgt
+++ binutils/gas/configure.tgt
-@@ -86,6 +86,8 @@ case ${cpu} in
+@@ -87,6 +87,8 @@ case ${cpu} in
pj*) cpu_type=pj endian=big ;;
powerpc*le*) cpu_type=ppc endian=little ;;
powerpc*) cpu_type=ppc endian=big ;;
@@ -299,7 +315,7 @@
rs6000*) cpu_type=ppc ;;
rl78*) cpu_type=rl78 ;;
rx) cpu_type=rx ;;
-@@ -384,6 +386,8 @@ case ${generic_target} in
+@@ -391,6 +393,8 @@ case ${generic_target} in
ppc-*-kaos*) fmt=elf ;;
ppc-*-lynxos*) fmt=elf em=lynx ;;
@@ -308,7 +324,7 @@
s390-*-linux-*) fmt=elf em=linux ;;
s390-*-tpf*) fmt=elf ;;
-@@ -478,7 +482,7 @@ case ${generic_target} in
+@@ -488,7 +492,7 @@ case ${generic_target} in
esac
case ${cpu_type} in
@@ -319,7 +335,7 @@
esac
--- original-binutils/gas/Makefile.am
+++ binutils/gas/Makefile.am
-@@ -171,6 +171,7 @@ TARGET_CPU_CFILES = \
+@@ -177,6 +177,7 @@ TARGET_CPU_CFILES = \
config/tc-pdp11.c \
config/tc-pj.c \
config/tc-ppc.c \
@@ -327,7 +343,7 @@
config/tc-rl78.c \
config/tc-rx.c \
config/tc-s390.c \
-@@ -242,6 +243,7 @@ TARGET_CPU_HFILES = \
+@@ -250,6 +251,7 @@ TARGET_CPU_HFILES = \
config/tc-pdp11.h \
config/tc-pj.h \
config/tc-ppc.h \
@@ -337,7 +353,7 @@
config/tc-s390.h \
--- original-binutils/gas/Makefile.in
+++ binutils/gas/Makefile.in
-@@ -440,6 +440,7 @@ TARGET_CPU_CFILES = \
+@@ -448,6 +448,7 @@ TARGET_CPU_CFILES = \
config/tc-pdp11.c \
config/tc-pj.c \
config/tc-ppc.c \
@@ -345,7 +361,7 @@
config/tc-rl78.c \
config/tc-rx.c \
config/tc-s390.c \
-@@ -511,6 +512,7 @@ TARGET_CPU_HFILES = \
+@@ -521,6 +522,7 @@ TARGET_CPU_HFILES = \
config/tc-pdp11.h \
config/tc-pj.h \
config/tc-ppc.h \
@@ -353,7 +369,7 @@
config/tc-rl78.h \
config/tc-rx.h \
config/tc-s390.h \
-@@ -866,6 +868,7 @@ distclean-compile:
+@@ -878,6 +880,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-pdp11.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-pj.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-ppc.Po@am__quote@
@@ -361,7 +377,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-rl78.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-rx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-s390.Po@am__quote@
-@@ -1571,6 +1574,20 @@ tc-ppc.obj: config/tc-ppc.c
+@@ -1598,6 +1601,20 @@ tc-ppc.obj: config/tc-ppc.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-ppc.obj `if test -f 'config/tc-ppc.c'; then $(CYGPATH_W) 'config/tc-ppc.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-ppc.c'; fi`
@@ -384,7 +400,7 @@
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-rl78.Tpo $(DEPDIR)/tc-rl78.Po
--- original-binutils/include/dis-asm.h
+++ binutils/include/dis-asm.h
-@@ -254,6 +254,7 @@ extern int print_insn_little_arm (bfd_vm
+@@ -263,6 +263,7 @@ extern int print_insn_little_arm (bfd_vm
extern int print_insn_little_mips (bfd_vma, disassemble_info *);
extern int print_insn_little_nios2 (bfd_vma, disassemble_info *);
extern int print_insn_little_powerpc (bfd_vma, disassemble_info *);
@@ -392,7 +408,7 @@
extern int print_insn_little_score (bfd_vma, disassemble_info *);
extern int print_insn_lm32 (bfd_vma, disassemble_info *);
extern int print_insn_m32c (bfd_vma, disassemble_info *);
-@@ -313,6 +314,7 @@ extern void print_aarch64_disassembler_o
+@@ -327,6 +328,7 @@ extern void print_aarch64_disassembler_o
extern void print_i386_disassembler_options (FILE *);
extern void print_mips_disassembler_options (FILE *);
extern void print_ppc_disassembler_options (FILE *);
@@ -402,17 +418,17 @@
extern void print_s390_disassembler_options (FILE *);
--- original-binutils/include/elf/common.h
+++ binutils/include/elf/common.h
-@@ -301,6 +301,7 @@
- #define EM_INTEL207 207 /* Reserved by Intel */
- #define EM_INTEL208 208 /* Reserved by Intel */
- #define EM_INTEL209 209 /* Reserved by Intel */
+@@ -306,6 +306,7 @@
+ #define EM_VISIUM 221 /* Controls and Data Services VISIUMcore processor */
+ #define EM_FT32 222 /* FTDI Chip FT32 high performance 32-bit RISC architecture */
+ #define EM_MOXIE 223 /* Moxie processor family */
+#define EM_RISCV 243 /* RISC-V */
/* If it is necessary to assign new unofficial EM_* values, please pick large
random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
--- original-binutils/ld/configure.tgt
+++ binutils/ld/configure.tgt
-@@ -604,6 +604,12 @@ powerpc-*-aix*) targ_emul=aixppc ;;
+@@ -638,6 +638,12 @@ powerpc-*-aix*) targ_emul=aixppc ;;
powerpc-*-beos*) targ_emul=aixppc ;;
powerpc-*-windiss*) targ_emul=elf32ppcwindiss ;;
powerpc-*-lynxos*) targ_emul=ppclynx ;;
@@ -427,7 +443,7 @@
;;
--- original-binutils/ld/Makefile.am
+++ binutils/ld/Makefile.am
-@@ -258,6 +258,7 @@ ALL_EMULATION_SOURCES = \
+@@ -267,6 +267,7 @@ ALL_EMULATION_SOURCES = \
eelf32ppcsim.c \
eelf32ppcvxworks.c \
eelf32ppcwindiss.c \
@@ -435,7 +451,7 @@
eelf32rl78.c \
eelf32rx.c \
eelf32tilegx.c \
-@@ -464,6 +465,7 @@ ALL_64_EMULATION_SOURCES = \
+@@ -483,6 +484,7 @@ ALL_64_EMULATION_SOURCES = \
eelf64btsmip_fbsd.c \
eelf64hppa.c \
eelf64lppc.c \
@@ -443,8 +459,8 @@
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
-@@ -1104,6 +1106,11 @@ eelf32lppcsim.c: $(srcdir)/emulparams/el
- ldemul-list.h \
+@@ -1144,6 +1146,11 @@ eelf32lppcsim.c: $(srcdir)/emulparams/el
+ $(srcdir)/emultempl/ppc32elf.em ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf32lriscv.c: $(srcdir)/emulparams/elf32lriscv.sh \
@@ -455,7 +471,7 @@
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
$(ELF_DEPS) $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc \
-@@ -1861,6 +1868,12 @@ eelf64lppc.c: $(srcdir)/emulparams/elf64
+@@ -1937,6 +1944,12 @@ eelf64lppc.c: $(srcdir)/emulparams/elf64
ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -470,7 +486,7 @@
$(srcdir)/emulparams/elf32bmipn32-defs.sh $(ELF_DEPS) \
--- original-binutils/ld/Makefile.in
+++ binutils/ld/Makefile.in
-@@ -546,6 +546,7 @@ ALL_EMULATION_SOURCES = \
+@@ -577,6 +577,7 @@ ALL_EMULATION_SOURCES = \
eelf32lppclinux.c \
eelf32lppcnto.c \
eelf32lppcsim.c \
@@ -478,7 +494,7 @@
eelf32m32c.c \
eelf32mb_linux.c \
eelf32mbel_linux.c \
-@@ -771,6 +772,7 @@ ALL_64_EMULATION_SOURCES = \
+@@ -812,6 +813,7 @@ ALL_64_EMULATION_SOURCES = \
eelf64btsmip_fbsd.c \
eelf64hppa.c \
eelf64lppc.c \
@@ -486,7 +502,7 @@
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
-@@ -1157,6 +1159,7 @@ distclean-compile:
+@@ -1219,6 +1221,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppclinux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcnto.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcsim.Po@am__quote@
@@ -494,7 +510,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900n32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lsmip.Po@am__quote@
-@@ -1211,6 +1214,7 @@ distclean-compile:
+@@ -1274,6 +1277,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Po@am__quote@
@@ -502,8 +518,8 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Po@am__quote@
-@@ -2545,6 +2549,11 @@ eelf32lppcsim.c: $(srcdir)/emulparams/el
- ldemul-list.h \
+@@ -2650,6 +2654,11 @@ eelf32lppcsim.c: $(srcdir)/emulparams/el
+ $(srcdir)/emultempl/ppc32elf.em ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf32lriscv.c: $(srcdir)/emulparams/elf32lriscv.sh \
@@ -514,7 +530,7 @@
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
$(ELF_DEPS) $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc \
-@@ -3302,6 +3311,12 @@ eelf64lppc.c: $(srcdir)/emulparams/elf64
+@@ -3443,6 +3452,12 @@ eelf64lppc.c: $(srcdir)/emulparams/elf64
ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -529,7 +545,7 @@
$(srcdir)/emulparams/elf32bmipn32-defs.sh $(ELF_DEPS) \
--- original-binutils/opcodes/configure
+++ binutils/opcodes/configure
-@@ -12590,6 +12590,7 @@ if test x${all_targets} = xfalse ; then
+@@ -12603,6 +12603,7 @@ if test x${all_targets} = xfalse ; then
bfd_powerpc_arch) ta="$ta ppc-dis.lo ppc-opc.lo" ;;
bfd_powerpc_64_arch) ta="$ta ppc-dis.lo ppc-opc.lo" ;;
bfd_pyramid_arch) ;;
@@ -539,7 +555,7 @@
bfd_rl78_arch) ta="$ta rl78-dis.lo rl78-decode.lo";;
--- original-binutils/opcodes/disassemble.c
+++ binutils/opcodes/disassemble.c
-@@ -373,6 +373,11 @@ disassembler (abfd)
+@@ -376,6 +376,11 @@ disassembler (abfd)
disassemble = print_insn_little_powerpc;
break;
#endif
@@ -551,7 +567,7 @@
#ifdef ARCH_rs6000
case bfd_arch_rs6000:
if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
-@@ -545,6 +550,9 @@ disassembler_usage (stream)
+@@ -558,6 +563,9 @@ disassembler_usage (stream)
#ifdef ARCH_powerpc
print_ppc_disassembler_options (stream);
#endif
@@ -561,21 +577,3 @@
#ifdef ARCH_i386
print_i386_disassembler_options (stream);
#endif
---- original-binutils/bfd/Makefile.in 2014-10-14 00:32:02.000000000 -0700
-+++ binutils/bfd/Makefile.in 2015-03-31 06:53:23.253426230 -0700
-@@ -442,6 +442,7 @@
- cpu-pj.lo \
- cpu-plugin.lo \
- cpu-powerpc.lo \
-+ cpu-riscv.lo \
- cpu-rs6000.lo \
- cpu-rl78.lo \
- cpu-rx.lo \
-@@ -526,6 +527,7 @@
- cpu-pj.c \
- cpu-plugin.c \
- cpu-powerpc.c \
-+ cpu-riscv.c \
- cpu-rs6000.c \
- cpu-rl78.c \
- cpu-rx.c \