brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.1 KiB · 8df834d Raw
208 lines · plain
1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello32.o2# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t32.o3# RUN: wasm-ld -m wasm32 -no-gc-sections --export=__data_end --export=__heap_base --allow-undefined --no-entry -o %t32.wasm %t32.o %t.hello32.o4# RUN: obj2yaml %t32.wasm | FileCheck -DPTR=I32 %s5#6# RUN: llvm-mc -filetype=obj -triple=wasm64-unknown-unknown %p/Inputs/hello.s -o %t.hello64.o7# RUN: llvm-mc -filetype=obj -triple=wasm64-unknown-unknown %s -o %t64.o8# RUN: wasm-ld -m wasm64 -no-gc-sections --export=__data_end --export=__heap_base --allow-undefined --no-entry -o %t64.wasm %t64.o %t.hello64.o9# RUN: obj2yaml %t64.wasm | FileCheck --check-prefixes CHECK,CHK64 -DPTR=I64 %s10 11        .section .data.foo,"",@12        .globl  foo13        .hidden  foo14        .p2align        215foo:16        .int32  117        .size   foo, 418 19 20        .section .data.aligned_bar,"",@21        .globl  aligned_bar22        .hidden  aligned_bar23        .p2align        424aligned_bar:25        .int32  326        .size   aligned_bar, 427 28 29        .section .data.external_ref,"",@30        .globl  external_ref31        .p2align        332external_ref:33        .int32  hello_str34        .size   external_ref, 435 36 37        .section .bss.local_struct,"",@38        .globl  local_struct39        .hidden  local_struct40        .p2align        241local_struct:42        .skip   843        .size   local_struct, 844 45 46        .section .data.local_struct_internal_ptr,"",@47        .globl  local_struct_internal_ptr48        .hidden  local_struct_internal_ptr49        .p2align        250local_struct_internal_ptr:51        .int32  local_struct+452        .size   local_struct_internal_ptr, 453        .size   hello_str, 454 55# CHECK:        - Type:            MEMORY56# CHECK-NEXT:     Memories:57# CHK64-NEXT:       - Flags:           [ IS_64 ]58# CHECK-NEXT:         Minimum:         0x259# CHECK-NEXT:   - Type:            GLOBAL60# CHECK-NEXT:     Globals:61# CHECK-NEXT:       - Index:           062# CHECK-NEXT:         Type:            [[PTR]]63# CHECK-NEXT:         Mutable:         true64# CHECK-NEXT:         InitExpr:65# CHECK-NEXT:           Opcode:          [[PTR]]_CONST66# CHECK-NEXT:           Value:           6553667# CHECK-NEXT:       - Index:           168# CHECK-NEXT:         Type:            [[PTR]]69# CHECK-NEXT:         Mutable:         false70# CHECK-NEXT:         InitExpr:71# CHECK-NEXT:           Opcode:          [[PTR]]_CONST72# CHECK-NEXT:           Value:           6559273# CHECK-NEXT:       - Index:           274# CHECK-NEXT:         Type:            [[PTR]]75# CHECK-NEXT:         Mutable:         false76# CHECK-NEXT:         InitExpr:77# CHECK-NEXT:           Opcode:          [[PTR]]_CONST78# CHECK-NEXT:           Value:           6560079 80# CHECK:        - Type:            DATA81# CHECK-NEXT:     Segments:82# CHECK-NEXT:       - SectionOffset:   883# CHECK-NEXT:         InitFlags:       084# CHECK-NEXT:         Offset:85# CHECK-NEXT:           Opcode:          [[PTR]]_CONST86# CHECK-NEXT:           Value:           6553687# CHECK-NEXT:         Content:         68656C6C6F0A0088# CHECK-NEXT:       - SectionOffset:   2289# CHECK-NEXT:         InitFlags:       090# CHECK-NEXT:         Offset:91# CHECK-NEXT:           Opcode:          [[PTR]]_CONST92# CHECK-NEXT:           Value:           6555293 94 95# RUN: wasm-ld -no-gc-sections --allow-undefined --no-entry \96# RUN:     --initial-memory=131072 --max-memory=131072 -o %t_max.wasm %t32.o \97# RUN:     %t.hello32.o98# RUN: obj2yaml %t_max.wasm | FileCheck %s -check-prefix=CHECK-MAX99 100# CHECK-MAX:        - Type:            MEMORY101# CHECK-MAX-NEXT:     Memories:102# CHECK-MAX-NEXT:       - Flags:           [ HAS_MAX ]103# CHECK-MAX-NEXT:         Minimum:         0x2104# CHECK-MAX-NEXT:         Maximum:         0x2105 106# RUN: wasm-ld --no-entry --initial-memory=327680 --no-growable-memory \107# RUN:     -o %t_max.wasm %t.hello32.o108# RUN: obj2yaml %t_max.wasm | FileCheck %s -check-prefix=CHECK-NO-GROWTH109 110# CHECK-NO-GROWTH:        - Type:            MEMORY111# CHECK-NO-GROWTH-NEXT:     Memories:112# CHECK-NO-GROWTH-NEXT:       - Flags:           [ HAS_MAX ]113# CHECK-NO-GROWTH-NEXT:         Minimum:         0x5114# CHECK-NO-GROWTH-NEXT:         Maximum:         0x5115 116# RUN: not wasm-ld --max-memory=262144 --no-growable-memory \117# RUN:     --no-entry -o %t_max.wasm %t.hello32.o 2>&1 \118# RUN: | FileCheck %s --check-prefix CHECK-NO-GROWTH-COMPAT-ERROR119 120# CHECK-NO-GROWTH-COMPAT-ERROR: --max-memory is incompatible with --no-growable-memory121 122# RUN: wasm-ld -no-gc-sections --allow-undefined --no-entry --shared-memory \123# RUN:     --features=atomics,bulk-memory --initial-memory=131072 \124# RUN:     --max-memory=131072 -o %t_max.wasm %t32.o %t.hello32.o125# RUN: obj2yaml %t_max.wasm | FileCheck %s -check-prefix=CHECK-SHARED126 127# CHECK-SHARED:        - Type:            MEMORY128# CHECK-SHARED-NEXT:     Memories:129# CHECK-SHARED-NEXT:       - Flags:           [ HAS_MAX, IS_SHARED ]130# CHECK-SHARED-NEXT:         Minimum:         0x2131# CHECK-SHARED-NEXT:         Maximum:         0x2132 133# XUN: wasm-ld --relocatable -o %t_reloc.wasm %t32.o %t.hello32.o134# XUN: obj2yaml %t_reloc.wasm | FileCheck %s -check-prefix=RELOC135 136# RELOC:       - Type:            DATA137# RELOC-NEXT:     Relocations:138# RELOC-NEXT:       - Type:            R_WASM_MEMORY_ADDR_I32139# RELOC-NEXT:         Index:           3140# RELOC-NEXT:         Offset:          0x24141# RELOC-NEXT:       - Type:            R_WASM_MEMORY_ADDR_I32142# RELOC-NEXT:         Index:           4143# RELOC-NEXT:         Offset:          0x2D144# RELOC-NEXT:         Addend:          4145# RELOC-NEXT:     Segments:146# RELOC-NEXT:       - SectionOffset:   6147# RELOC-NEXT:         InitFlags:       0148# RELOC-NEXT:         Offset:149# RELOC-NEXT:           Opcode:          I32_CONST150# RELOC-NEXT:           Value:           0151# RELOC-NEXT:         Content:         68656C6C6F0A00152# RELOC-NEXT:       - SectionOffset:   18153# RELOC-NEXT:         InitFlags:       0154# RELOC-NEXT:         Offset:155# RELOC-NEXT:           Opcode:          I32_CONST156# RELOC-NEXT:           Value:           8157# RELOC-NEXT:         Content:         '01000000'158# RELOC-NEXT:       - SectionOffset:   27159# RELOC-NEXT:         InitFlags:       0160# RELOC-NEXT:         Offset:161# RELOC-NEXT:           Opcode:          I32_CONST162# RELOC-NEXT:           Value:           16163# RELOC-NEXT:         Content:         '03000000'164# RELOC-NEXT:       - SectionOffset:   36165# RELOC-NEXT:         InitFlags:       0166# RELOC-NEXT:         Offset:167# RELOC-NEXT:           Opcode:          I32_CONST168# RELOC-NEXT:           Value:           24169# RELOC-NEXT:         Content:         '00000000'170# RELOC-NEXT:       - SectionOffset:   45171# RELOC-NEXT:         InitFlags:       0172# RELOC-NEXT:         Offset:173# RELOC-NEXT:           Opcode:          I32_CONST174# RELOC-NEXT:           Value:           28175# RELOC-NEXT:         Content:         '24000000'176# RELOC-NEXT:       - SectionOffset:   54177# RELOC-NEXT:         InitFlags:       0178# RELOC-NEXT:         Offset:179# RELOC-NEXT:           Opcode:          I32_CONST180# RELOC-NEXT:           Value:           32181# RELOC-NEXT:         Content:         '0000000000000000'182 183# RELOC:          SymbolTable:184# RELOC-NEXT:       - Index:           0185# RELOC-NEXT:         Kind:            DATA186# RELOC-NEXT:         Name:            foo187# RELOC-NEXT:         Flags:           [ VISIBILITY_HIDDEN ]188# RELOC-NEXT:         Segment:         1189# RELOC-NEXT:         Size:            4190# RELOC-NEXT:       - Index:           1191# RELOC-NEXT:         Kind:            DATA192# RELOC-NEXT:         Name:            aligned_bar193# RELOC-NEXT:         Flags:           [ VISIBILITY_HIDDEN ]194# RELOC-NEXT:         Segment:         2195# RELOC-NEXT:         Size:            4196# RELOC-NEXT:       - Index:           2197# RELOC-NEXT:         Kind:            DATA198# RELOC-NEXT:         Name:            external_ref199# RELOC-NEXT:         Flags:           [  ]200# RELOC-NEXT:         Segment:         3201# RELOC-NEXT:         Size:            4202# RELOC-NEXT:       - Index:           3203# RELOC-NEXT:         Kind:            DATA204# RELOC-NEXT:         Name:            hello_str205# RELOC-NEXT:         Flags:           [  ]206# RELOC-NEXT:         Segment:         0207# RELOC-NEXT:         Size:            7208