[PATCH] D59173: [WebAssembly][WIP] Target features section

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 20:11:25 PST 2019


tlively created this revision.
tlively added reviewers: aheejin, sbc100, dschuff.
Herald added subscribers: llvm-commits, jdoerfert, jfb, mgrang, sunfish, hiraditya, jgravelle-google.
Herald added a project: LLVM.

Implements a new target features section in assembly and object files
that records what features are used, required, and disallowed in
WebAssembly objects. The linker uses this information to ensure that
all objects participating in a link are feature-compatible and records
the set of used features in the output binary for use by optimizers
and other tools later in the toolchain.

The "atomics" feature is always required or disallowed to prevent
linking code with stripped atomics into multithreaded binaries. Other
features are marked used if they are enabled globally or on any
function in a module.

Future CLs will add linker flags for ignoring feature compatibility
checks and for specifying the set of allowed features, implement using
the presence of the "atomics" feature to control the type of memory
and segments in the linked binary, and add front-end flags for
loosening the linkage policy for atomics.

Tests will be added for the following behaviors before this CL lands:

- used features are emitted properly
- atomics are required or disallowed
- ObjectYAML handles empty string features
- ObjectYAML round trips arbitrary features, including empty strings
- the linker detects required feature violations
- the linker detects disallowed feature violations
- the linker handles empty string features
- the assembler and MC can properly round-trip the features section


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59173

Files:
  lld/wasm/InputFiles.cpp
  lld/wasm/InputFiles.h
  lld/wasm/Writer.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/include/llvm/ObjectYAML/WasmYAML.h
  llvm/lib/MC/MCParser/WasmAsmParser.cpp
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/ObjectYAML/WasmYAML.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h
  llvm/test/MC/WebAssembly/array-fill.ll
  llvm/test/MC/WebAssembly/assembler-binary.ll
  llvm/test/MC/WebAssembly/bss.ll
  llvm/test/MC/WebAssembly/comdat.ll
  llvm/test/MC/WebAssembly/debug-info.ll
  llvm/test/MC/WebAssembly/explicit-sections.ll
  llvm/test/MC/WebAssembly/global-ctor-dtor.ll
  llvm/test/MC/WebAssembly/visibility.ll
  llvm/test/MC/WebAssembly/weak-alias.ll
  llvm/test/MC/WebAssembly/weak.ll
  llvm/tools/obj2yaml/wasm2yaml.cpp
  llvm/tools/yaml2obj/yaml2wasm.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59173.189980.patch
Type: text/x-patch
Size: 31393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190309/7c536a35/attachment-0001.bin>


More information about the llvm-commits mailing list