Commit Graph

21 Commits

Author SHA1 Message Date
Sam Clegg cc2da5554b [lld][WebAssembly] Add initial support for -Map/--print-map
Differential Revision: https://reviews.llvm.org/D77187
2020-09-12 16:10:51 -07:00
Thomas Lively 190dacc3cc [WebAssembly] Elide data segments for .bss sections
Summary:
WebAssembly memories are zero-initialized, so when module does not
import its memory initializing .bss sections is guaranteed to be a
no-op. To reduce binary size and initialization time, .bss sections
are simply not emitted into the final binary unless the memory is
imported.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 374940
2019-10-15 19:05:11 +00:00
Rui Ueyama 136d27ab4d [Coding style change][lld] Rename variables for non-ELF ports
This patch does the same thing as r365595 to other subdirectories,
which completes the naming style change for the entire lld directory.

With this, the naming style conversion is complete for lld.

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

llvm-svn: 365730
2019-07-11 05:40:30 +00:00
Rui Ueyama 7e296adec7 Make functions and member variables distinguishable even after the name style change. NFC.
llvm-svn: 365605
2019-07-10 09:10:01 +00:00
Sam Clegg 8fcf012693 [WebAssembly] Refactor synthetic sections and relocation processing. NFC.
Major refactor to better match the structure of the ELF linker.

- Split out relocation processing into scanRelocations
- Split out synthetic sections into their own classes.

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

llvm-svn: 361233
2019-05-21 09:13:09 +00:00
Sam Clegg d029bf0f8c [WebAssembly] Move code and data section generation to finalizeContent. NFC.
Previously these sections were being generated during their
constructors.  This moves the work to finalizeContent, and also does
the same for the relocation sections because their contents depends
on the final layout too.

This change is part of a larger refactor to how we deal with synthetic
sections: https://reviews.llvm.org/D61811

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

llvm-svn: 360941
2019-05-16 21:36:06 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Sam Clegg 45218f4af9 [WebAssembly] Remove `using` statements from header files. NFC.
Differential Revision: https://reviews.llvm.org/D54758

llvm-svn: 347621
2018-11-27 01:08:16 +00:00
Heejin Ahn 4821ebf73f [WebAssembly] clang-format (NFC)
Summary: This patch runs clang-format on all wasm-only files.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 340970
2018-08-29 21:03:16 +00:00
Sam Clegg d177ab2a5f [WebAssembly] Add support for debug (DWARF) sections
Specifically add support for custom sections that contain
relocations, and for the two new relocation types needed
by DWARF sections.

See: https://reviews.llvm.org/D44184

Patch by Yury Delendik!

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

llvm-svn: 331566
2018-05-04 23:14:42 +00:00
Sam Clegg 80ba43872e [WebAssembly] Add support for custom sections
Copy user-defined custom sections into the output, concatenating
sections with the same name.

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

llvm-svn: 329717
2018-04-10 16:12:49 +00:00
Rui Ueyama 22c8f33a9b [WebAssembly] Return a StringRef instead of std::string from getSectionName(). NFC.
Differential Revision: https://reviews.llvm.org/D43854

llvm-svn: 326337
2018-02-28 17:33:04 +00:00
Rui Ueyama 4a1b2bbc88 [WebAssembly] Do not use inheritance to define SubSection.
SubSection inherited from SyntheticSection, and SyntheticSection inherits
from OutputSection, so SubSection was an OutputSection. But that's wrong
because SubSection is not actually a WebAssembly output section.
It shares some functionalities with OutputSection, but overall it's very
different.

This patch removes that inheritance.

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

llvm-svn: 326286
2018-02-28 00:52:42 +00:00
Rui Ueyama 1184253891 Refactor wasm/WriterUtil.{cpp,h}.
Summary:
 - Makes code more in line with LLVM style (e.g. const char * -> StringRef)
 - Do not use formatv since we can construct message just by `+`
 - Replace some odd types such as `const StringRef` with more common type
 - Do not use default arguments if they are not necessary

Reviewers: sbc100

Subscribers: jfb, aheejin, llvm-commits, sunfish

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

llvm-svn: 325383
2018-02-16 20:38:00 +00:00
Sam Clegg 5fa274bea4 [WebAssembly] Add InputChunk as common base class for InputSegment and InputFunction. NFC.
Differential Revision: https://reviews.llvm.org/D41419

llvm-svn: 322148
2018-01-10 01:13:34 +00:00
Sam Clegg 8d146bbc0c [WebAssembly] Output functions individually
The code section is now written out one function
at a time rather than all the functions in a given
objects being serialized at once.

This change lays the groundwork for supporting
--gc-sections.

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

llvm-svn: 322138
2018-01-09 23:56:44 +00:00
Sam Clegg ab2ac29066 [WebAssembly] Improve toString(OutputSection). NFC.
llvm-svn: 321146
2017-12-20 05:14:48 +00:00
Sam Clegg 5e8cba9e39 [WebAssembly] Apply data relocations in parallel. NFC.
Store data relocations with their respective segment.
This allows relocations to be applied as each segment
is written (and therefore in parallel).

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

llvm-svn: 321105
2017-12-19 20:45:15 +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 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 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