[WebAssembly] Target features section
Summary:
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
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
# RUN: yaml2obj %s -o %t1.o
|
|
|
|
|
2019-03-26 12:11:05 +08:00
|
|
|
# RUN: wasm-ld --no-entry --features=foo,bar,baz -o %t.specified.wasm %t1.o
|
|
|
|
# RUN: obj2yaml %t.specified.wasm | FileCheck %s --check-prefix SPECIFIED
|
|
|
|
|
|
|
|
# RUN: wasm-ld --no-entry --features=bar,baz,quux -o %t.unspecified.wasm %t1.o
|
|
|
|
# RUN: obj2yaml %t.unspecified.wasm | FileCheck %s --check-prefix UNSPECIFIED
|
|
|
|
|
[WebAssembly] Target features section
Summary:
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
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
# RUN: yaml2obj %S/Inputs/disallow-feature-foo.yaml -o %t.disallowed.o
|
2019-03-27 23:30:52 +08:00
|
|
|
# RUN: wasm-ld --no-entry -o - %t1.o %t.disallowed.o | obj2yaml | FileCheck %s --check-prefix DISALLOWED
|
[WebAssembly] Target features section
Summary:
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
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
|
|
|
|
# RUN: yaml2obj %S/Inputs/no-feature-foo.yaml -o %t.none.o
|
2019-03-27 23:30:52 +08:00
|
|
|
# RUN: wasm-ld --no-entry -o - %t1.o %t.none.o | obj2yaml | FileCheck %s --check-prefix NONE
|
[WebAssembly] Target features section
Summary:
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
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
|
|
|
|
# Check that the following combinations of feature linkage policies
|
|
|
|
# give the expected results:
|
|
|
|
#
|
|
|
|
# DISALLOWED x DISALLOWED => NONE
|
|
|
|
# DISALLOWED x NONE => NONE
|
|
|
|
|
|
|
|
--- !WASM
|
|
|
|
FileHeader:
|
|
|
|
Version: 0x00000001
|
|
|
|
Sections:
|
|
|
|
- Type: CUSTOM
|
|
|
|
Name: linking
|
|
|
|
Version: 2
|
|
|
|
- Type: CUSTOM
|
|
|
|
Name: target_features
|
|
|
|
Features:
|
|
|
|
- Prefix: DISALLOWED
|
|
|
|
Name: "foo"
|
|
|
|
# included so output has target features section
|
|
|
|
- Prefix: USED
|
|
|
|
Name: "bar"
|
|
|
|
...
|
|
|
|
|
2019-03-26 12:11:05 +08:00
|
|
|
# SPECIFIED: - Type: CUSTOM
|
2020-11-19 13:38:23 +08:00
|
|
|
# SPECIFIED: Name: target_features
|
2019-03-26 12:11:05 +08:00
|
|
|
# SPECIFIED-NEXT: Features:
|
|
|
|
# SPECIFIED-NEXT: - Prefix: USED
|
|
|
|
# SPECIFIED-NEXT: Name: bar
|
|
|
|
# SPECIFIED-NEXT: - Prefix: USED
|
|
|
|
# SPECIFIED-NEXT: Name: baz
|
|
|
|
# SPECIFIED-NEXT: - Prefix: USED
|
|
|
|
# SPECIFIED-NEXT: Name: foo
|
|
|
|
# SPECIFIED-NEXT: ...
|
|
|
|
|
|
|
|
# UNSPECIFIED: - Type: CUSTOM
|
2020-11-19 13:38:23 +08:00
|
|
|
# UNSPECIFIED: Name: target_features
|
2019-03-26 12:11:05 +08:00
|
|
|
# UNSPECIFIED-NEXT: Features:
|
|
|
|
# UNSPECIFIED-NEXT: - Prefix: USED
|
|
|
|
# UNSPECIFIED-NEXT: Name: bar
|
|
|
|
# UNSPECIFIED-NEXT: - Prefix: USED
|
|
|
|
# UNSPECIFIED-NEXT: Name: baz
|
|
|
|
# UNSPECIFIED-NEXT: - Prefix: USED
|
|
|
|
# UNSPECIFIED-NEXT: Name: quux
|
|
|
|
# UNSPECIFIED-NEXT: ...
|
|
|
|
|
[WebAssembly] Target features section
Summary:
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
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
# DISALLOWED: - Type: CUSTOM
|
2020-11-19 13:38:23 +08:00
|
|
|
# DISALLOWED: Name: target_features
|
[WebAssembly] Target features section
Summary:
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
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
# DISALLOWED-NEXT: Features:
|
|
|
|
# DISALLOWED-NEXT: - Prefix: USED
|
|
|
|
# DISALLOWED-NEXT: Name: bar
|
|
|
|
# DISALLOWED-NEXT: ...
|
|
|
|
|
|
|
|
# NONE: - Type: CUSTOM
|
2020-11-19 13:38:23 +08:00
|
|
|
# NONE: Name: target_features
|
[WebAssembly] Target features section
Summary:
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
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
# NONE-NEXT: Features:
|
|
|
|
# NONE-NEXT: - Prefix: USED
|
|
|
|
# NONE-NEXT: Name: bar
|
|
|
|
# NONE-NEXT: ...
|