This is combination of two patches by Nicholas Wilson: 1. https://reviews.llvm.org/D41954 2. https://reviews.llvm.org/D42495 Along with a few local modifications: - One change I made was to add the UNDEFINED bit to the binary format to avoid the extra byte used when writing data symbols. Although this bit is redundant for other symbols types (i.e. undefined can be implied if a function or global is a wasm import) - I prefer to be explicit and consistent and not have derived flags. - Some field renaming. - Some reverting of unrelated minor changes. - No test output differences. Differential Revision: https://reviews.llvm.org/D43147 llvm-svn: 325860
43 lines
793 B
LLVM
43 lines
793 B
LLVM
; RUN: llc -filetype=obj %s -o - | llvm-readobj -s | FileCheck %s
|
|
|
|
target triple = "wasm32-unknown-unknown-wasm"
|
|
|
|
; external function
|
|
declare i32 @a()
|
|
|
|
; global data
|
|
@b = global i32 3, align 4
|
|
|
|
; local function
|
|
define i32 @f1() {
|
|
entry:
|
|
%tmp1 = call i32 @a()
|
|
ret i32 %tmp1
|
|
}
|
|
|
|
; CHECK: Format: WASM
|
|
; CHECK: Arch: wasm32
|
|
; CHECK: AddressSize: 32bit
|
|
; CHECK: Sections [
|
|
; CHECK: Section {
|
|
; CHECK: Type: TYPE (0x1)
|
|
; CHECK: }
|
|
; CHECK: Section {
|
|
; CHECK: Type: IMPORT (0x2)
|
|
; CHECK: }
|
|
; CHECK: Section {
|
|
; CHECK: Type: FUNCTION (0x3)
|
|
; CHECK: }
|
|
; CHECK: Section {
|
|
; CHECK: Type: CODE (0xA)
|
|
; CHECK: }
|
|
; CHECK: Section {
|
|
; CHECK: Type: DATA (0xB)
|
|
; CHECK: }
|
|
; CHECK: Section {
|
|
; CHECK: Type: CUSTOM (0x0)
|
|
; CHECK: Name: reloc.CODE
|
|
; CHECK: }
|
|
; CHECK:]
|
|
|