include * elf/wasm32.h: New file to support wasm32 architecture.
bfd * cpu-wasm32.c: New file to support wasm32 architecture.
* elf32-wasm32.c: New file to support wasm32 architecture.
* Makefile.am: Add wasm32 architecture.
* archures.c: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
cpu-vax.lo \
cpu-visium.lo \
cpu-w65.lo \
+ cpu-wasm32.lo \
cpu-we32k.lo \
cpu-xc16x.lo \
cpu-xgate.lo \
cpu-v850_rh850.c \
cpu-vax.c \
cpu-visium.c \
+ cpu-wasm32.c \
cpu-w65.c \
cpu-we32k.c \
cpu-xc16x.c \
elf32-v850.lo \
elf32-vax.lo \
elf32-visium.lo \
+ elf32-wasm32.lo \
elf32-xc16x.lo \
elf32-xgate.lo \
elf32-xstormy16.lo \
elf32-v850.c \
elf32-vax.c \
elf32-visium.c \
+ elf32-wasm32.c \
elf32-xc16x.c \
elf32-xgate.c \
elf32-xstormy16.c \
cpu-vax.lo \
cpu-visium.lo \
cpu-w65.lo \
+ cpu-wasm32.lo \
cpu-we32k.lo \
cpu-xc16x.lo \
cpu-xgate.lo \
cpu-v850_rh850.c \
cpu-vax.c \
cpu-visium.c \
+ cpu-wasm32.c \
cpu-w65.c \
cpu-we32k.c \
cpu-xc16x.c \
elf32-v850.lo \
elf32-vax.lo \
elf32-visium.lo \
+ elf32-wasm32.lo \
elf32-xc16x.lo \
elf32-xgate.lo \
elf32-xstormy16.lo \
elf32-v850.c \
elf32-vax.c \
elf32-visium.c \
+ elf32-wasm32.c \
elf32-xc16x.c \
elf32-xgate.c \
elf32-xstormy16.c \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-vax.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-visium.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-w65.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-wasm32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-we32k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-xc16x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-xgate.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-v850.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-vax.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-visium.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-wasm32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xc16x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xgate.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xstormy16.Plo@am__quote@
.#define bfd_mach_nios2r2 2
. bfd_arch_visium, {* Visium *}
.#define bfd_mach_visium 1
+. bfd_arch_wasm32, {* WebAssembly *}
+.#define bfd_mach_wasm32 1
. bfd_arch_pru, {* PRU *}
.#define bfd_mach_pru 0
. bfd_arch_last
extern const bfd_arch_info_type bfd_v850_rh850_arch;
extern const bfd_arch_info_type bfd_vax_arch;
extern const bfd_arch_info_type bfd_visium_arch;
+extern const bfd_arch_info_type bfd_wasm32_arch;
extern const bfd_arch_info_type bfd_w65_arch;
extern const bfd_arch_info_type bfd_we32k_arch;
extern const bfd_arch_info_type bfd_xstormy16_arch;
&bfd_vax_arch,
&bfd_visium_arch,
&bfd_w65_arch,
+ &bfd_wasm32_arch,
&bfd_we32k_arch,
&bfd_xstormy16_arch,
&bfd_xtensa_arch,
#define bfd_mach_nios2r2 2
bfd_arch_visium, /* Visium */
#define bfd_mach_visium 1
+ bfd_arch_wasm32, /* WebAssembly */
+#define bfd_mach_wasm32 1
bfd_arch_pru, /* PRU */
#define bfd_mach_pru 0
bfd_arch_last
tilepro*) targ_archs=bfd_tilepro_arch ;;
v850*) targ_archs="bfd_v850_arch bfd_v850_rh850_arch" ;;
visium*) targ_archs=bfd_visium_arch ;;
+wasm32) targ_archs=bfd_wasm32_arch ;;
x86_64*) targ_archs=bfd_i386_arch ;;
xtensa*) targ_archs=bfd_xtensa_arch ;;
xgate) targ_archs=bfd_xgate_arch ;;
targ_defvec=visium_elf32_vec
;;
+ wasm32-*-*)
+ targ_defvec=wasm32_elf32_vec
+ ;;
+
we32k-*-*)
targ_defvec=we32k_coff_vec
;;
ft32_elf32_vec) tb="$tb elf32-ft32.lo elf32.lo $elf" ;;
visium_elf32_vec) tb="$tb elf32-visium.lo elf32.lo $elf" ;;
w65_coff_vec) tb="$tb coff-w65.lo reloc16.lo $coffgen" ;;
+ wasm32_elf32_vec) tb="$tb elf32-wasm32.lo elf32.lo $elf" ;;
we32k_coff_vec) tb="$tb coff-we32k.lo $coffgen" ;;
x86_64_coff_vec) tb="$tb coff-x86_64.lo $coff"; target_size=64 ;;
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
ft32_elf32_vec) tb="$tb elf32-ft32.lo elf32.lo $elf" ;;
visium_elf32_vec) tb="$tb elf32-visium.lo elf32.lo $elf" ;;
w65_coff_vec) tb="$tb coff-w65.lo reloc16.lo $coffgen" ;;
+ wasm32_elf32_vec) tb="$tb elf32-wasm32.lo elf32.lo $elf" ;;
we32k_coff_vec) tb="$tb coff-we32k.lo $coffgen" ;;
x86_64_coff_vec) tb="$tb coff-x86_64.lo $coff"; target_size=64 ;;
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
--- /dev/null
+/* BFD support for the WebAssembly target
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ 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; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "libiberty.h"
+
+#define N(number, print, default, next) \
+{ 32, 32, 8, bfd_arch_wasm32, number, "wasm32", "wasm32", 4, default, bfd_default_compatible, \
+ bfd_default_scan, bfd_arch_default_fill, next }
+
+static const bfd_arch_info_type arch_info_struct[] =
+{
+ N (bfd_mach_wasm32, "wasm32", TRUE, NULL)
+};
+
+const bfd_arch_info_type bfd_wasm32_arch =
+ N (bfd_mach_wasm32, "wasm32", TRUE, & arch_info_struct[0]);
--- /dev/null
+/* 32-bit ELF for the WebAssembly target
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ 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; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "bfd_stdint.h"
+#include "elf/wasm32.h"
+
+#define ELF_ARCH bfd_arch_wasm32
+#define ELF_TARGET_ID EM_WEBASSEMBLY
+#define ELF_MACHINE_CODE EM_WEBASSEMBLY
+/* FIXME we don't have paged executables, see:
+ https://github.com/pipcet/binutils-gdb/issues/4 */
+#define ELF_MAXPAGESIZE 4096
+
+#define TARGET_LITTLE_SYM wasm32_elf32_vec
+#define TARGET_LITTLE_NAME "elf32-wasm32"
+
+#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
+/* For testing. */
+#define elf_backend_want_dynrelro 1
+
+#define bfd_elf32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
+
+#define ELF_DYNAMIC_INTERPRETER "/sbin/elf-dynamic-interpreter.so"
+
+#define elf_backend_want_got_plt 1
+#define elf_backend_plt_readonly 1
+#define elf_backend_got_header_size 0
+
+#include "elf32-target.h"
cpu-vax.c
cpu-visium.c
cpu-w65.c
+cpu-wasm32.c
cpu-we32k.c
cpu-xc16x.c
cpu-xgate.c
elf32-v850.c
elf32-vax.c
elf32-visium.c
+elf32-wasm32.c
elf32-xc16x.c
elf32-xgate.c
elf32-xstormy16.c
extern const bfd_target vax_elf32_vec;
extern const bfd_target visium_elf32_vec;
extern const bfd_target w65_coff_vec;
+extern const bfd_target wasm32_elf32_vec;
extern const bfd_target we32k_coff_vec;
extern const bfd_target x86_64_coff_vec;
extern const bfd_target x86_64_elf32_vec;
&w65_coff_vec,
+ &wasm32_elf32_vec,
+
&we32k_coff_vec,
#ifdef BFD64
+2017-03-27 Pip Cet <pipcet@gmail.com>
+
+ * elf/wasm32.h: New file to support wasm32 architecture.
+
2017-03-27 Rinat Zelig <rinat@mellanox.com>
* opcode/arc.h (insn_class_t): Add ULTRAIP and MISC class.
--- /dev/null
+/* ELF support for BFD for the WebAssembly target
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ 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; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _ELF_WASM32_H
+#define _ELF_WASM32_H
+
+#include "elf/reloc-macros.h"
+
+/* Relocation types. */
+
+START_RELOC_NUMBERS (elf_wasm32_reloc_type)
+END_RELOC_NUMBERS (R_WASM32_max = 1)
+
+#endif /* _ELF_WASM32_H */