Add minimal support for WebAssembly backend to the BFD library.
[external/binutils.git] / bfd / elf32-wasm32.c
1 /* 32-bit ELF for the WebAssembly target
2    Copyright (C) 2017 Free Software Foundation, Inc.
3
4    This file is part of BFD, the Binary File Descriptor library.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street - Fifth Floor,
19    Boston, MA 02110-1301, USA.  */
20
21 #include "sysdep.h"
22 #include "bfd.h"
23 #include "libbfd.h"
24 #include "elf-bfd.h"
25 #include "bfd_stdint.h"
26 #include "elf/wasm32.h"
27
28 #define ELF_ARCH                bfd_arch_wasm32
29 #define ELF_TARGET_ID           EM_WEBASSEMBLY
30 #define ELF_MACHINE_CODE        EM_WEBASSEMBLY
31 /* FIXME we don't have paged executables, see:
32    https://github.com/pipcet/binutils-gdb/issues/4  */
33 #define ELF_MAXPAGESIZE         4096
34
35 #define TARGET_LITTLE_SYM       wasm32_elf32_vec
36 #define TARGET_LITTLE_NAME      "elf32-wasm32"
37
38 #define elf_backend_can_gc_sections     1
39 #define elf_backend_rela_normal         1
40 /* For testing. */
41 #define elf_backend_want_dynrelro       1
42
43 #define bfd_elf32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
44 #define bfd_elf32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
45
46 #define ELF_DYNAMIC_INTERPRETER  "/sbin/elf-dynamic-interpreter.so"
47
48 #define elf_backend_want_got_plt        1
49 #define elf_backend_plt_readonly        1
50 #define elf_backend_got_header_size     0
51
52 #include "elf32-target.h"