Commit Graph

582 Commits

Author SHA1 Message Date
Rui Ueyama
909d123893 Change function type more LLVM-ish.
Also fix variable naming style.

llvm-svn: 320393
2017-12-11 17:52:28 +00:00
Sam Clegg
2c096bacc6 [WebAssembly] Add --no-entry argument
This adds a `--no-entry` argument to wasm LLD used to
suppress the default `_start` entry point.

Patch by Nicholas Wilson!

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

llvm-svn: 320167
2017-12-08 17:58:25 +00:00
Sam Clegg
0fb6faa0be Prefer ArrayRef over const std::vector&
Differential Revision: https://reviews.llvm.org/D40993

llvm-svn: 320125
2017-12-08 01:09:21 +00:00
Sam Clegg
c5872e864a [WebAssembly] Add check to ensure symbol VA is only set once. NFC.
Also remove resulting unneeded function.

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

llvm-svn: 320118
2017-12-08 00:13:14 +00:00
Sam Clegg
80cfdd6b56 [WebAssembly] Remove used variable
llvm-svn: 320007
2017-12-07 03:51:37 +00:00
Sam Clegg
31de2f0ccf [WebAssembly] Add -u/--undefined argument handling
Adds a new argument to wasm-lld, `--undefined`, with
similar semantics to the ELF linker. It pulls in symbols
from files contained within a `.a` archive, forcing them
to be included even if the translation unit would not
otherwise be pulled in.

Patch by Nicholas Wilson

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

llvm-svn: 320004
2017-12-07 03:19:53 +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
Rui Ueyama
bdc5150984 Always evaluate the second argument for CHECK() lazily.
This patch is to rename check CHECK and make it a C macro, so that
we can evaluate the second argument lazily.

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

llvm-svn: 319974
2017-12-06 22:08:17 +00:00
Sam Clegg
a681a1167e [WebAssembly] Remove wasm/Strings.cpp+h
This file contained only a single function that was only
really needed in one place, so just inline it.

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

llvm-svn: 319876
2017-12-06 03:10:39 +00:00
Sam Clegg
b3974ffda0 [WebAssembly] Fix stack pointer relocations
This line was mistakenly deleted in rL319813

Add a test for stackpointer relocations.

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

llvm-svn: 319828
2017-12-05 20:38:22 +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
3b4a475c37 [WebAssembly] Remove used --sysroot option
Differential Revision: https://reviews.llvm.org/D40771

llvm-svn: 319805
2017-12-05 18:13: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
7e7566323d toString function take a const refs where possible
Differential Revision: https://reviews.llvm.org/D40824

llvm-svn: 319787
2017-12-05 16:50:46 +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
Rui Ueyama
69989bdbf2 clang-format.
llvm-svn: 319512
2017-12-01 02:11:29 +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
7d5a13799a Use llvm::StringSet instead of std::set.
std::set is pretty slow. We generally prefer llvm::StringSet if we don't
need an sorted set.

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

llvm-svn: 319371
2017-11-29 22:21:37 +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
ceb15e8a51 Fix spelling. NFC.
llvm-svn: 319238
2017-11-28 22:17:39 +00:00
Rui Ueyama
2445b0ccac Remove unused using.
llvm-svn: 319236
2017-11-28 22:14:13 +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
f95826dccd [WebAssembly] Remove initializers from Config.h
These should get initialized in by Driver.cpp based on
command line options.

Also, sort entries.

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

llvm-svn: 319219
2017-11-28 20:27:21 +00:00
Rui Ueyama
3e03944f02 Factor out more code to Common/Args.cpp.
Differential Revision: https://reviews.llvm.org/D40540

llvm-svn: 319211
2017-11-28 19:58:45 +00:00
Rui Ueyama
53fe469162 Factor out common code to Common/Strings.cpp.
Differential Revision: https://reviews.llvm.org/D40530

llvm-svn: 319138
2017-11-28 02:15:26 +00:00
Sam Clegg
a80d94d52b Rename Symtab private memory to avoid confusion with global Symtab
This is also consistent with SymVector that exists in COFF port
and soon to be added to the wasm port.

Split off as part of https://reviews.llvm.org/D40371

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

llvm-svn: 319113
2017-11-27 23:16:06 +00:00
Sam Clegg
e2ed092e01 Consistent use of <internal> when displaying internal symbol names
Differential Revision: https://reviews.llvm.org/D40510

llvm-svn: 319108
2017-11-27 22:49:16 +00:00
David Blaikie
c004ffcd42 wasm/OutputSegment.h: Include missing header
llvm-svn: 318879
2017-11-22 21:10: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