[lld] c09acd5 - [WebAssembly] Handle event exports
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 11:29:21 PDT 2020
Author: Heejin Ahn
Date: 2020-04-06T11:28:38-07:00
New Revision: c09acd5dd1472e73d5c33250ced5b9a805ea8f4a
URL: https://github.com/llvm/llvm-project/commit/c09acd5dd1472e73d5c33250ced5b9a805ea8f4a
DIFF: https://github.com/llvm/llvm-project/commit/c09acd5dd1472e73d5c33250ced5b9a805ea8f4a.diff
LOG: [WebAssembly] Handle event exports
Summary: This handles exports of events, which was missing.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77566
Added:
Modified:
lld/test/wasm/event-section.ll
lld/wasm/WriterUtils.cpp
Removed:
################################################################################
diff --git a/lld/test/wasm/event-section.ll b/lld/test/wasm/event-section.ll
index 7bd87907e931..15ef6366efee 100644
--- a/lld/test/wasm/event-section.ll
+++ b/lld/test/wasm/event-section.ll
@@ -2,7 +2,9 @@
; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %p/Inputs/event-section2.ll -o %t2.o
; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %s -o %t.o
; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o
+; RUN: wasm-ld --export-all -o %t-export-all.wasm %t.o %t1.o %t2.o
; RUN: obj2yaml %t.wasm | FileCheck %s
+; RUN: obj2yaml %t-export-all.wasm | FileCheck %s --check-prefix=EXPORT-ALL
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
@@ -35,3 +37,9 @@ define void @_start() {
; Global section has to come after event section
; CHECK: - Type: GLOBAL
+
+; EXPORT-ALL: - Type: EXPORT
+; EXPORT-ALL-NEXT Exports:
+; EXPORT-ALL: - Name: __cpp_exception
+; EXPORT-ALL: Kind: EVENT
+; EXPORT-ALL: Index: 0
diff --git a/lld/wasm/WriterUtils.cpp b/lld/wasm/WriterUtils.cpp
index d0733d847814..4f1bce61d936 100644
--- a/lld/wasm/WriterUtils.cpp
+++ b/lld/wasm/WriterUtils.cpp
@@ -217,6 +217,9 @@ void writeExport(raw_ostream &os, const WasmExport &export_) {
case WASM_EXTERNAL_GLOBAL:
writeUleb128(os, export_.Index, "global index");
break;
+ case WASM_EXTERNAL_EVENT:
+ writeUleb128(os, export_.Index, "event index");
+ break;
case WASM_EXTERNAL_MEMORY:
writeUleb128(os, export_.Index, "memory index");
break;
More information about the llvm-commits
mailing list