Commit Graph

19 Commits

Author SHA1 Message Date
Sam Clegg ab2ac29066 [WebAssembly] Improve toString(OutputSection). NFC.
llvm-svn: 321146
2017-12-20 05:14:48 +00:00
Sam Clegg d451da1bd1 [WebAssembly] Fix a couple of typos. NFC.
Also remove unneeded braces and old comment.

llvm-svn: 321103
2017-12-19 19:56:27 +00:00
Sam Clegg 0d0dd39159 [WebAssembly] Add support for writing out init functions in linking section
This change add support for init functions in the linking
section, but only in -r/--relocatable mode.

Differential Revision: https://reviews.llvm.org/D41375

llvm-svn: 321088
2017-12-19 17:09:45 +00:00
Sam Clegg f61676a18a [WebAssembly] Move code for copying of data segment relocation. NFC.
This is a preparetory change for function gc which also
requires relocations to be copied in ranges like this.

Differential Revision: https://reviews.llvm.org/D41313

llvm-svn: 320948
2017-12-17 17:52:01 +00:00
Sam Clegg c018115480 [WebAssembly] Don't include lazy symbols in import table
This bug was introduced in: https://reviews.llvm.org/D41304.
Add a test for this case.

Differential Revision: https://reviews.llvm.org/D41309

llvm-svn: 320872
2017-12-15 22:17:15 +00:00
Sam Clegg 574d7ce954 [WebAssembly] Base imports on Symtab. NFC.
Since imports are undefined symbols we know we can
find all of them my looking at the symbol table alone.
(i.e. imports cannot be have local binding).

This will be strictly faster and also allows us
to to remove a method from Symbol class

Differential Revision: https://reviews.llvm.org/D41304

llvm-svn: 320847
2017-12-15 19:23:49 +00:00
Sam Clegg fc1a912b9b [WebAssembly] De-dup indirect function table.
Create the indirect function table based on symbols rather
than just duplicating the input entries.  This has the
effect of de-duplicating the table.

This is a followup to the equivalent change made for globals:
  https://reviews.llvm.org/D40859

Partially based on a patch by Nicholas Wilson:
  https://reviews.llvm.org/D40845

Differential Revision: https://reviews.llvm.org/D40989

llvm-svn: 320428
2017-12-11 22:00:56 +00:00
Sam Clegg 3f1fb88afb [WebAssembly] Preserve ordering of global symbols
This change restores the behavior that global indexes
are assigned in object file order.  This was accidentally
changed in https://reviews.llvm.org/D40859.

Differential Revision: https://reviews.llvm.org/D41038

llvm-svn: 320426
2017-12-11 21:52:21 +00:00
Sam Clegg 74fe0ba105 [WebAssembly] Fix symbol exports under -r/--relocatable
This change cleans up the way wasm exports and globals
are generated, particualrly for -r/--relocatable where
globals need to be created and exported in order for
output relocations which reference them.

Remove the need for a per file GlobalIndexOffset and
instead set the output index for each symbol directly.
This simplifies the code in several places.

Differential Revision: https://reviews.llvm.org/D40859

llvm-svn: 320001
2017-12-07 01:51:24 +00:00
Sam Clegg 4eedcfc946 [WebAssembly] Improve support linker synthetic symbols
This is part of larger change to add synthetic symbols
for section start/end points and init/fini_array:
  https://reviews.llvm.org/D40760

Allows synthetic global symbols to have an explicitly set
virtual address.

Differential Revision: https://reviews.llvm.org/D40843

llvm-svn: 319813
2017-12-05 19:05:45 +00:00
Sam Clegg 22cfe52398 [WebAssembly] Simplify check for emitting relocations
This is a small change I split of from a larger one
that simplifies the condition that need to be checked
when decided if we need to emit relocation and all the
things they depend on (symbols, etc).

Differential Revision: https://reviews.llvm.org/D40825

llvm-svn: 319789
2017-12-05 16:53:25 +00:00
Sam Clegg 4b27c0554c Reland "[WebAssembly] Add support for visibility flag""
Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish

Differential Revision: https://reviews.llvm.org/D40773

llvm-svn: 319627
2017-12-03 02:38:04 +00:00
Heejin Ahn 675147b54d [WebAssembly] Revert r319592 "Add support for visibility flag"
r319488 reportedly broke one of LLVM bots (ubuntu-gcc7.1-werror), and this patch
depends on that patch.
See http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/3369 for
details.

llvm-svn: 319603
2017-12-02 02:05:50 +00:00
Sam Clegg e7487e4c92 [WebAssembly] Add support for visibility flag
Patch by Nicholas Wilson

Differential Revision: https://reviews.llvm.org/D40690

llvm-svn: 319592
2017-12-01 22:37:25 +00:00
Sam Clegg 49ed926287 [WebAssembly] Fix typos
Patch by Nicholas Wilson

Differential Revision: https://reviews.llvm.org/D40691

llvm-svn: 319506
2017-12-01 00:53:21 +00:00
Sam Clegg b862159683 [WebAssembly] Allow function signature checking at link time
This change allows checking of function signatures but
does not yes enable it by default.  In this mode, linking
two objects that were compiled with a different signatures
for the same function will produce a link error.

New options for enabling and disabling this feature have been
added: (--check-signatures/--no-check-signatures).

Differential Revision: https://reviews.llvm.org/D40371

llvm-svn: 319396
2017-11-30 01:40:08 +00:00
Rui Ueyama e48f223ed6 Remove `else` or `break` after `fatal`. NFC.
fatal() does not return, so we don't need `else` or `break` after a call
of fatal.

llvm-svn: 319355
2017-11-29 20:45:58 +00:00
Rui Ueyama 2017d52b54 Move Memory.{h,cpp} to Common.
Differential Revision: https://reviews.llvm.org/D40571

llvm-svn: 319221
2017-11-28 20:39:17 +00:00
Sam Clegg c94d393ad5 [WebAssembly] Initial wasm linker implementation
This linker backend is still a work in progress but is
enough to link simple programs including linking against
library archives.

Differential Revision: https://reviews.llvm.org/D34851

llvm-svn: 318539
2017-11-17 18:14:09 +00:00