diff --git a/compiler-rt/test/hwasan/TestCases/register-dump-read.c b/compiler-rt/test/hwasan/TestCases/register-dump-read.c index 8325857fa9163c..002c5dd5e1f9e8 100644 --- a/compiler-rt/test/hwasan/TestCases/register-dump-read.c +++ b/compiler-rt/test/hwasan/TestCases/register-dump-read.c @@ -1,11 +1,11 @@ -// RUN: %clang_hwasan -ffixed-x10 -ffixed-x20 -ffixed-x27 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK -// RUN: %clang_hwasan -ffixed-x10 -ffixed-x20 -ffixed-x27 -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK -// RUN: %clang_hwasan -ffixed-x10 -ffixed-x20 -ffixed-x27 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK -// RUN: %clang_hwasan -ffixed-x10 -ffixed-x20 -ffixed-x27 -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_hwasan -ffixed-x10 -ffixed-x23 -ffixed-x27 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_hwasan -ffixed-x10 -ffixed-x23 -ffixed-x27 -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_hwasan -ffixed-x10 -ffixed-x23 -ffixed-x27 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_hwasan -ffixed-x10 -ffixed-x23 -ffixed-x27 -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK // REQUIRES: aarch64-target-arch -// RUN: %clang_hwasan -ffixed-x10 -ffixed-x20 -ffixed-x27 -O2 %s -o %t && not %env_hwasan_opts=fast_unwind_on_fatal=true %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK -// RUN: %clang_hwasan -ffixed-x10 -ffixed-x20 -ffixed-x27 -O2 %s -o %t && not %env_hwasan_opts=fast_unwind_on_fatal=false %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_hwasan -ffixed-x10 -ffixed-x23 -ffixed-x27 -O2 %s -o %t && not %env_hwasan_opts=fast_unwind_on_fatal=true %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_hwasan -ffixed-x10 -ffixed-x23 -ffixed-x27 -O2 %s -o %t && not %env_hwasan_opts=fast_unwind_on_fatal=false %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK #include #include diff --git a/lld/test/wasm/alias.s b/lld/test/wasm/alias.s index b2ab45e98d9598..6c99f69da8b87c 100644 --- a/lld/test/wasm/alias.s +++ b/lld/test/wasm/alias.s @@ -22,6 +22,14 @@ _start: # CHECK-NEXT: ReturnTypes: [] # CHECK-NEXT: - Type: FUNCTION # CHECK-NEXT: FunctionTypes: [ 0 ] +# CHECK-NEXT: - Type: TABLE +# CHECK-NEXT: Tables: +# CHECK-NEXT: - Index: 0 +# CHECK-NEXT: ElemType: FUNCREF +# CHECK-NEXT: Limits: +# CHECK-NEXT: Flags: [ HAS_MAX ] +# CHECK-NEXT: Initial: 0x1 +# CHECK-NEXT: Maximum: 0x1 # CHECK-NEXT: - Type: MEMORY # CHECK-NEXT: Memories: # CHECK-NEXT: - Initial: 0x2 diff --git a/lld/test/wasm/init-fini.ll b/lld/test/wasm/init-fini.ll index 5631d58d68e5c6..1e7644bc6d357e 100644 --- a/lld/test/wasm/init-fini.ll +++ b/lld/test/wasm/init-fini.ll @@ -139,15 +139,15 @@ entry: ; RELOC-NEXT: InitFunctions [ ; RELOC-NEXT: 0 (priority=101) ; RELOC-NEXT: 1 (priority=101) -; RELOC-NEXT: 15 (priority=101) -; RELOC-NEXT: 11 (priority=101) -; RELOC-NEXT: 21 (priority=101) -; RELOC-NEXT: 11 (priority=202) -; RELOC-NEXT: 23 (priority=202) +; RELOC-NEXT: 14 (priority=101) +; RELOC-NEXT: 10 (priority=101) +; RELOC-NEXT: 20 (priority=101) +; RELOC-NEXT: 10 (priority=202) +; RELOC-NEXT: 22 (priority=202) ; RELOC-NEXT: 0 (priority=1001) -; RELOC-NEXT: 17 (priority=1001) -; RELOC-NEXT: 11 (priority=2002) -; RELOC-NEXT: 25 (priority=2002) +; RELOC-NEXT: 16 (priority=1001) +; RELOC-NEXT: 10 (priority=2002) +; RELOC-NEXT: 24 (priority=2002) ; RELOC-NEXT: 9 (priority=4000) -; RELOC-NEXT: 19 (priority=4000) +; RELOC-NEXT: 18 (priority=4000) ; RELOC-NEXT: ] diff --git a/lld/test/wasm/local-symbols.ll b/lld/test/wasm/local-symbols.ll index 216aced9cf0777..13c200d648e930 100644 --- a/lld/test/wasm/local-symbols.ll +++ b/lld/test/wasm/local-symbols.ll @@ -35,6 +35,14 @@ entry: ; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 1 ] +; CHECK-NEXT: - Type: TABLE +; CHECK-NEXT: Tables: +; CHECK-NEXT: - Index: 0 +; CHECK-NEXT: ElemType: FUNCREF +; CHECK-NEXT: Limits: +; CHECK-NEXT: Flags: [ HAS_MAX ] +; CHECK-NEXT: Initial: 0x1 +; CHECK-NEXT: Maximum: 0x1 ; CHECK-NEXT: - Type: MEMORY ; CHECK-NEXT: Memories: ; CHECK-NEXT: - Initial: 0x2 diff --git a/lld/test/wasm/locals-duplicate.test b/lld/test/wasm/locals-duplicate.test index cf9a148d4ab788..07abb748538149 100644 --- a/lld/test/wasm/locals-duplicate.test +++ b/lld/test/wasm/locals-duplicate.test @@ -254,40 +254,40 @@ ; RELOC-NEXT: - Type: CODE ; RELOC-NEXT: Relocations: ; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 19 +; RELOC-NEXT: Index: 18 ; RELOC-NEXT: Offset: 0x13 ; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB ; RELOC-NEXT: Index: 3 ; RELOC-NEXT: Offset: 0x1C ; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 20 +; RELOC-NEXT: Index: 19 ; RELOC-NEXT: Offset: 0x25 ; RELOC-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 17 +; RELOC-NEXT: Index: 16 ; RELOC-NEXT: Offset: 0x2E ; RELOC-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB ; RELOC-NEXT: Index: 0 ; RELOC-NEXT: Offset: 0x37 ; RELOC-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 18 +; RELOC-NEXT: Index: 17 ; RELOC-NEXT: Offset: 0x40 ; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 11 +; RELOC-NEXT: Index: 10 ; RELOC-NEXT: Offset: 0x58 ; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 23 +; RELOC-NEXT: Index: 22 ; RELOC-NEXT: Offset: 0x61 ; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 24 +; RELOC-NEXT: Index: 23 ; RELOC-NEXT: Offset: 0x6A ; RELOC-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 9 +; RELOC-NEXT: Index: 8 ; RELOC-NEXT: Offset: 0x73 ; RELOC-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 21 +; RELOC-NEXT: Index: 20 ; RELOC-NEXT: Offset: 0x7C ; RELOC-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 22 +; RELOC-NEXT: Index: 21 ; RELOC-NEXT: Offset: 0x85 ; RELOC-NEXT: Functions: ; RELOC-NEXT: - Index: 0 @@ -410,92 +410,87 @@ ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 8 ; RELOC-NEXT: - Index: 8 -; RELOC-NEXT: Kind: TABLE -; RELOC-NEXT: Name: __indirect_function_table -; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ] -; RELOC-NEXT: Table: 0 -; RELOC-NEXT: - Index: 9 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: colliding_func1 ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 9 -; RELOC-NEXT: - Index: 10 +; RELOC-NEXT: - Index: 9 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global1B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 12 -; RELOC-NEXT: - Index: 11 +; RELOC-NEXT: - Index: 10 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global1 ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Segment: 0 ; RELOC-NEXT: Offset: 4 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 12 +; RELOC-NEXT: - Index: 11 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global2B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 13 -; RELOC-NEXT: - Index: 13 +; RELOC-NEXT: - Index: 12 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global3B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 14 -; RELOC-NEXT: - Index: 14 +; RELOC-NEXT: - Index: 13 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_func1B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 15 -; RELOC-NEXT: - Index: 15 +; RELOC-NEXT: - Index: 14 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_func2B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 16 -; RELOC-NEXT: - Index: 16 +; RELOC-NEXT: - Index: 15 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_func3B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 17 -; RELOC-NEXT: - Index: 17 +; RELOC-NEXT: - Index: 16 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: colliding_func1 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Function: 0 -; RELOC-NEXT: - Index: 18 +; RELOC-NEXT: - Index: 17 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: colliding_func3 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Function: 2 -; RELOC-NEXT: - Index: 19 +; RELOC-NEXT: - Index: 18 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global1 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Segment: 0 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 20 +; RELOC-NEXT: - Index: 19 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global3 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Segment: 2 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 21 +; RELOC-NEXT: - Index: 20 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: colliding_func2 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Function: 10 -; RELOC-NEXT: - Index: 22 +; RELOC-NEXT: - Index: 21 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: colliding_func3 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Function: 11 -; RELOC-NEXT: - Index: 23 +; RELOC-NEXT: - Index: 22 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global2 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Segment: 1 ; RELOC-NEXT: Offset: 4 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 24 +; RELOC-NEXT: - Index: 23 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global3 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] diff --git a/lld/test/wasm/pie.ll b/lld/test/wasm/pie.ll index 1aca4df3a594df..84555a08f19db5 100644 --- a/lld/test/wasm/pie.ll +++ b/lld/test/wasm/pie.ll @@ -41,6 +41,14 @@ define void @_start() { ; CHECK: - Type: IMPORT ; CHECK-NEXT: Imports: ; CHECK-NEXT: - Module: env +; CHECK-NEXT: Field: __indirect_function_table +; CHECK-NEXT: Kind: TABLE +; CHECK-NEXT: Table: +; CHECK-NEXT: Index: 0 +; CHECK-NEXT: ElemType: FUNCREF +; CHECK-NEXT: Limits: +; CHECK-NEXT: Initial: 0x1 +; CHECK-NEXT: - Module: env ; CHECK-NEXT: Field: __stack_pointer ; CHECK-NEXT: Kind: GLOBAL ; CHECK-NEXT: GlobalType: I32 @@ -55,14 +63,6 @@ define void @_start() { ; CHECK-NEXT: Kind: GLOBAL ; CHECK-NEXT: GlobalType: I32 ; CHECK-NEXT: GlobalMutable: false -; CHECK-NEXT: - Module: env -; CHECK-NEXT: Field: __indirect_function_table -; CHECK-NEXT: Kind: TABLE -; CHECK-NEXT: Table: -; CHECK-NEXT: Index: 0 -; CHECK-NEXT: ElemType: FUNCREF -; CHECK-NEXT: Limits: -; CHECK-NEXT: Initial: 0x1 ; CHECK: - Type: START ; CHECK-NEXT: StartFunction: 2 diff --git a/lld/test/wasm/section-symbol-relocs.yaml b/lld/test/wasm/section-symbol-relocs.yaml index 34126cbf12520e..3248ed62521afe 100644 --- a/lld/test/wasm/section-symbol-relocs.yaml +++ b/lld/test/wasm/section-symbol-relocs.yaml @@ -54,8 +54,8 @@ Sections: # RELOC-NEXT: - Index: 0 # RELOC-NEXT: Kind: SECTION # RELOC-NEXT: Flags: [ BINDING_LOCAL ] -# RELOC-NEXT: Section: 1 +# RELOC-NEXT: Section: 2 # RELOC-NEXT: - Index: 1 # RELOC-NEXT: Kind: SECTION # RELOC-NEXT: Flags: [ BINDING_LOCAL ] -# RELOC-NEXT: Section: 2 +# RELOC-NEXT: Section: 3 diff --git a/lld/test/wasm/shared.ll b/lld/test/wasm/shared.ll index 61337fcc6a3a06..98751adda48901 100644 --- a/lld/test/wasm/shared.ll +++ b/lld/test/wasm/shared.ll @@ -69,6 +69,14 @@ declare void @func_external() ; CHECK-NEXT: Memory: ; CHECK-NEXT: Initial: 0x1 ; CHECK-NEXT: - Module: env +; CHECK-NEXT: Field: __indirect_function_table +; CHECK-NEXT: Kind: TABLE +; CHECK-NEXT: Table: +; CHECK-NEXT: Index: 0 +; CHECK-NEXT: ElemType: FUNCREF +; CHECK-NEXT: Limits: +; CHECK-NEXT: Initial: 0x2 +; CHECK-NEXT: - Module: env ; CHECK-NEXT: Field: __stack_pointer ; CHECK-NEXT: Kind: GLOBAL ; CHECK-NEXT: GlobalType: I32 @@ -87,14 +95,6 @@ declare void @func_external() ; CHECK-NEXT: Field: func_external ; CHECK-NEXT: Kind: FUNCTION ; CHECK-NEXT: SigIndex: 1 -; CHECK-NEXT: - Module: env -; CHECK-NEXT: Field: __indirect_function_table -; CHECK-NEXT: Kind: TABLE -; CHECK-NEXT: Table: -; CHECK-NEXT: Index: 0 -; CHECK-NEXT: ElemType: FUNCREF -; CHECK-NEXT: Limits: -; CHECK-NEXT: Initial: 0x2 ; CHECK-NEXT: - Module: GOT.mem ; CHECK-NEXT: Field: indirect_func ; CHECK-NEXT: Kind: GLOBAL diff --git a/lld/test/wasm/signature-mismatch.ll b/lld/test/wasm/signature-mismatch.ll index 65ce73910ffaba..d5f95b0073c06d 100644 --- a/lld/test/wasm/signature-mismatch.ll +++ b/lld/test/wasm/signature-mismatch.ll @@ -80,22 +80,17 @@ declare i32 @ret32(i32, i64, i32) local_unnamed_addr ; RELOC-NEXT: Segment: 0 ; RELOC-NEXT: Size: 4 ; RELOC-NEXT: - Index: 3 -; RELOC-NEXT: Kind: TABLE -; RELOC-NEXT: Name: __indirect_function_table -; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ] -; RELOC-NEXT: Table: 0 -; RELOC-NEXT: - Index: 4 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: call_ret32 ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 3 -; RELOC-NEXT: - Index: 5 +; RELOC-NEXT: - Index: 4 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: ret32_address ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Segment: 1 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 6 +; RELOC-NEXT: - Index: 5 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: 'signature_mismatch:ret32' ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] diff --git a/lld/test/wasm/stack-pointer.ll b/lld/test/wasm/stack-pointer.ll index 11ab62fab1ae9a..8efb2aae1ee5e0 100644 --- a/lld/test/wasm/stack-pointer.ll +++ b/lld/test/wasm/stack-pointer.ll @@ -30,6 +30,14 @@ entry: ; CHECK-NEXT: GlobalMutable: true ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0 ] +; CHECK-NEXT: - Type: TABLE +; CHECK-NEXT: Tables: +; CHECK-NEXT: - Index: 0 +; CHECK-NEXT: ElemType: FUNCREF +; CHECK-NEXT: Limits: +; CHECK-NEXT: Flags: [ HAS_MAX ] +; CHECK-NEXT: Initial: 0x1 +; CHECK-NEXT: Maximum: 0x1 ; CHECK-NEXT: - Type: MEMORY ; CHECK-NEXT: Memories: ; CHECK-NEXT: - Initial: 0x0 diff --git a/lld/test/wasm/weak-alias.ll b/lld/test/wasm/weak-alias.ll index 387501963d4b9b..9d903f73dd320e 100644 --- a/lld/test/wasm/weak-alias.ll +++ b/lld/test/wasm/weak-alias.ll @@ -276,11 +276,6 @@ entry: ; RELOC-NEXT: Name: call_direct_ptr ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 5 -; RELOC-NEXT: - Index: 8 -; RELOC-NEXT: Kind: TABLE -; RELOC-NEXT: Name: __indirect_function_table -; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ] -; RELOC-NEXT: Table: 0 ; RELOC-NEXT: - Type: CUSTOM ; RELOC-NEXT: Name: name ; RELOC-NEXT: FunctionNames: diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index d349a6abf5e64b..84fdb77aea2c05 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -10,7 +10,6 @@ #include "Config.h" #include "InputChunks.h" #include "InputGlobal.h" -#include "InputTable.h" #include "MarkLive.h" #include "SymbolTable.h" #include "Writer.h" @@ -788,58 +787,6 @@ static void wrapSymbols(ArrayRef wrapped) { symtab->wrap(w.sym, w.real, w.wrap); } -static TableSymbol *createDefinedIndirectFunctionTable(StringRef name) { - const uint32_t invalidIndex = -1; - WasmLimits limits{0, 0, 0}; // Set by the writer. - WasmTableType type{uint8_t(ValType::FUNCREF), limits}; - WasmTable desc{invalidIndex, type, name}; - InputTable *table = make(desc, nullptr); - uint32_t flags = config->exportTable ? 0 : WASM_SYMBOL_VISIBILITY_HIDDEN; - TableSymbol *sym = symtab->addSyntheticTable(name, flags, table); - sym->markLive(); - sym->forceExport = config->exportTable; - return sym; -} - -static TableSymbol *createUndefinedIndirectFunctionTable(StringRef name) { - WasmLimits limits{0, 0, 0}; // Set by the writer. - WasmTableType *type = make(); - type->ElemType = uint8_t(ValType::FUNCREF); - type->Limits = limits; - StringRef module(defaultModule); - uint32_t flags = config->exportTable ? 0 : WASM_SYMBOL_VISIBILITY_HIDDEN; - flags |= WASM_SYMBOL_UNDEFINED; - Symbol *sym = - symtab->addUndefinedTable(name, name, module, flags, nullptr, type); - sym->markLive(); - sym->forceExport = config->exportTable; - return cast(sym); -} - -static TableSymbol *resolveIndirectFunctionTable() { - // Even though we may not need a table, if the user explicitly specified - // --import-table or --export-table, ensure a table is residualized. - if (config->importTable) - return createUndefinedIndirectFunctionTable(functionTableName); - if (config->exportTable) - return createDefinedIndirectFunctionTable(functionTableName); - - // Otherwise, check to the symtab to find the indirect function table. - if (Symbol *sym = symtab->find(functionTableName)) { - if (sym->isLive()) { - if (auto *t = dyn_cast(sym)) { - return t->isDefined() - ? t - : createDefinedIndirectFunctionTable(functionTableName); - } - } - } - - // An indirect function table will only be present in the symbol table if - // needed by a reloc; if we get here, we don't need one. - return nullptr; -} - void LinkerDriver::linkerMain(ArrayRef argsArr) { WasmOptTable parser; opt::InputArgList args = parser.parse(argsArr.slice(1)); @@ -1029,12 +976,6 @@ void LinkerDriver::linkerMain(ArrayRef argsArr) { // Do size optimizations: garbage collection markLive(); - // Provide the indirect funciton table if needed. - WasmSym::indirectFunctionTable = resolveIndirectFunctionTable(); - - if (errorCount()) - return; - // Write the result to the file. writeResult(); } diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp index 1101cfb1a21009..1d0f016f325a66 100644 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -310,71 +310,6 @@ static void setRelocs(const std::vector &chunks, } } -// Since LLVM 12, we expect that if an input file defines or uses a table, it -// declares the tables using symbols and records each use with a relocation. -// This way when the linker combines inputs, it can collate the tables used by -// the inputs, assigning them distinct table numbers, and renumber all the uses -// as appropriate. At the same time, the linker has special logic to build the -// indirect function table if it is needed. -// -// However, object files produced by LLVM 11 and earlier neither write table -// symbols nor record relocations, and yet still use tables via call_indirect, -// and via function pointer bitcasts. We can detect these object files, as they -// declare tables as imports or define them locally, but don't have table -// symbols. synthesizeTableSymbols serves as a shim when loading these older -// input files, defining the missing symbols to allow the indirect function -// table to be built. -// -// Table uses in these older files won't be relocated, as they have no -// relocations. In practice this isn't a problem, as these object files -// typically just declare a single table named __indirect_function_table and -// having table number 0, so relocation would be idempotent anyway. -void ObjFile::synthesizeTableSymbols() { - uint32_t tableNumber = 0; - const WasmGlobalType *globalType = nullptr; - const WasmEventType *eventType = nullptr; - const WasmSignature *signature = nullptr; - if (wasmObj->getNumImportedTables()) { - for (const auto &import : wasmObj->imports()) { - if (import.Kind == WASM_EXTERNAL_TABLE) { - auto *info = make(); - info->Name = import.Field; - info->Kind = WASM_SYMBOL_TYPE_TABLE; - info->ImportModule = import.Module; - info->ImportName = import.Field; - info->Flags = WASM_SYMBOL_UNDEFINED; - info->Flags |= WASM_SYMBOL_NO_STRIP; - info->ElementIndex = tableNumber++; - LLVM_DEBUG(dbgs() << "Synthesizing symbol for table import: " - << info->Name << "\n"); - auto *wasmSym = make(*info, globalType, &import.Table, - eventType, signature); - symbols.push_back(createUndefined(*wasmSym, false)); - // Because there are no TABLE_NUMBER relocs in this case, we can't - // compute accurate liveness info; instead, just mark the symbol as - // always live. - symbols.back()->markLive(); - } - } - } - for (const auto &table : tables) { - auto *info = make(); - // Empty name. - info->Kind = WASM_SYMBOL_TYPE_TABLE; - info->Flags = WASM_SYMBOL_BINDING_LOCAL; - info->Flags |= WASM_SYMBOL_VISIBILITY_HIDDEN; - info->Flags |= WASM_SYMBOL_NO_STRIP; - info->ElementIndex = tableNumber++; - LLVM_DEBUG(dbgs() << "Synthesizing symbol for table definition: " - << info->Name << "\n"); - auto *wasmSym = make(*info, globalType, &table->getType(), - eventType, signature); - symbols.push_back(createDefined(*wasmSym)); - // Mark live, for the same reasons as for imported tables. - symbols.back()->markLive(); - } -} - void ObjFile::parse(bool ignoreComdats) { // Parse a memory buffer as a wasm file. LLVM_DEBUG(dbgs() << "Parsing object: " << toString(this) << "\n"); @@ -489,11 +424,8 @@ void ObjFile::parse(bool ignoreComdats) { // Populate `Symbols` based on the symbols in the object. symbols.reserve(wasmObj->getNumberOfSymbols()); - bool haveTableSymbol = false; for (const SymbolRef &sym : wasmObj->symbols()) { const WasmSymbol &wasmSym = wasmObj->getWasmSymbol(sym.getRawDataRefImpl()); - if (wasmSym.isTypeTable()) - haveTableSymbol = true; if (wasmSym.isDefined()) { // createDefined may fail if the symbol is comdat excluded in which case // we fall back to creating an undefined symbol @@ -505,13 +437,6 @@ void ObjFile::parse(bool ignoreComdats) { size_t idx = symbols.size(); symbols.push_back(createUndefined(wasmSym, isCalledDirectly[idx])); } - - // As a stopgap measure while implementing table support, if the object file - // has table definitions or imports but no table symbols, synthesize symbols - // for those tables. Mark as NO_STRIP to ensure they reach the output file, - // even if there are no TABLE_NUMBER relocs against them. - if (!haveTableSymbol) - synthesizeTableSymbols(); } bool ObjFile::isExcludedByComdat(InputChunk *chunk) const { diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h index 8a471389e7d185..4243a4447a92e7 100644 --- a/lld/wasm/InputFiles.h +++ b/lld/wasm/InputFiles.h @@ -157,7 +157,6 @@ class ObjFile : public InputFile { Symbol *createUndefined(const WasmSymbol &sym, bool isCalledDirectly); bool isExcludedByComdat(InputChunk *chunk) const; - void synthesizeTableSymbols(); std::unique_ptr wasmObj; }; diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp index f21774b0eec1a4..c47e0953bfaacc 100644 --- a/lld/wasm/MarkLive.cpp +++ b/lld/wasm/MarkLive.cpp @@ -177,9 +177,6 @@ void markLive() { for (InputGlobal *g : symtab->syntheticGlobals) if (!g->live) message("removing unused section " + toString(g)); - for (InputTable *t : symtab->syntheticTables) - if (!t->live) - message("removing unused section " + toString(t)); } } diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp index d93b2a14dc5a1a..c5af5cafa8bdf3 100644 --- a/lld/wasm/SymbolTable.cpp +++ b/lld/wasm/SymbolTable.cpp @@ -270,18 +270,6 @@ DefinedGlobal *SymbolTable::addOptionalGlobalSymbols(StringRef name, return replaceSymbol(s, name, flags, nullptr, global); } -DefinedTable *SymbolTable::addSyntheticTable(StringRef name, uint32_t flags, - InputTable *table) { - LLVM_DEBUG(dbgs() << "addSyntheticTable: " << name << " -> " << table - << "\n"); - Symbol *s = find(name); - assert(!s || s->isUndefined()); - if (!s) - s = insertName(name).first; - syntheticTables.emplace_back(table); - return replaceSymbol(s, name, flags, nullptr, table); -} - static bool shouldReplace(const Symbol *existing, InputFile *newFile, uint32_t newFlags) { // If existing symbol is undefined, replace it. diff --git a/lld/wasm/SymbolTable.h b/lld/wasm/SymbolTable.h index ce7219c3ba4f57..921a6edaa51670 100644 --- a/lld/wasm/SymbolTable.h +++ b/lld/wasm/SymbolTable.h @@ -93,8 +93,6 @@ class SymbolTable { DefinedData *addOptionalDataSymbol(StringRef name, uint64_t value = 0); DefinedGlobal *addOptionalGlobalSymbols(StringRef name, uint32_t flags, InputGlobal *global); - DefinedTable *addSyntheticTable(StringRef name, uint32_t flags, - InputTable *global); void handleSymbolVariants(); void handleWeakUndefines(); @@ -105,7 +103,6 @@ class SymbolTable { std::vector bitcodeFiles; std::vector syntheticFunctions; std::vector syntheticGlobals; - std::vector syntheticTables; private: std::pair insert(StringRef name, const InputFile *file); diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp index 173ad3131509f6..a403a47dcdd598 100644 --- a/lld/wasm/Symbols.cpp +++ b/lld/wasm/Symbols.cpp @@ -91,7 +91,6 @@ UndefinedGlobal *WasmSym::tableBase; DefinedData *WasmSym::definedTableBase; UndefinedGlobal *WasmSym::memoryBase; DefinedData *WasmSym::definedMemoryBase; -TableSymbol *WasmSym::indirectFunctionTable; WasmSymbolType Symbol::getWasmType() const { if (isa(this)) diff --git a/lld/wasm/Symbols.h b/lld/wasm/Symbols.h index c8ee0e14488152..8434f82539b97f 100644 --- a/lld/wasm/Symbols.h +++ b/lld/wasm/Symbols.h @@ -568,11 +568,6 @@ struct WasmSym { // Used in PIC code for offset of global data static UndefinedGlobal *memoryBase; static DefinedData *definedMemoryBase; - - // __indirect_function_table - // Used as an address space for function pointers, with each function that is - // used as a function pointer being allocated a slot. - static TableSymbol *indirectFunctionTable; }; // A buffer class that is large enough to hold any Symbol-derived diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp index 6044601c4e6a1b..967c2e2409247f 100644 --- a/lld/wasm/SyntheticSections.cpp +++ b/lld/wasm/SyntheticSections.cpp @@ -92,11 +92,20 @@ void TypeSection::writeBody() { writeSig(bodyOutputStream, *sig); } +ImportSection::ImportSection() : SyntheticSection(llvm::wasm::WASM_SEC_IMPORT) { + // FIXME: Remove when we treat __indirect_function_table as any other symbol. + if (config->importTable) { + numImportedTables++; + } +} + uint32_t ImportSection::getNumImports() const { assert(isSealed); uint32_t numImports = importedSymbols.size() + gotSymbols.size(); if (config->importMemory) ++numImports; + if (config->importTable) + ++numImports; return numImports; } @@ -145,6 +154,17 @@ void ImportSection::writeBody() { writeImport(os, import); } + if (config->importTable) { + uint32_t tableSize = config->tableBase + out.elemSec->numEntries(); + WasmImport import; + import.Module = defaultModule; + import.Field = functionTableName; + import.Kind = WASM_EXTERNAL_TABLE; + import.Table.ElemType = WASM_TYPE_FUNCREF; + import.Table.Limits = {0, tableSize, 0}; + writeImport(os, import); + } + for (const Symbol *sym : importedSymbols) { WasmImport import; if (auto *f = dyn_cast(sym)) { @@ -210,9 +230,26 @@ void FunctionSection::addFunction(InputFunction *func) { } void TableSection::writeBody() { + bool hasIndirectFunctionTable = !config->importTable; + + uint32_t tableCount = inputTables.size(); + if (hasIndirectFunctionTable) + tableCount++; + raw_ostream &os = bodyOutputStream; - writeUleb128(os, inputTables.size(), "table count"); + writeUleb128(os, tableCount, "table count"); + + if (hasIndirectFunctionTable) { + uint32_t tableSize = config->tableBase + out.elemSec->numEntries(); + WasmLimits limits; + if (config->growableTable) + limits = {0, tableSize, 0}; + else + limits = {WASM_LIMITS_FLAG_HAS_MAX, tableSize, tableSize}; + writeTableType(os, WasmTableType{WASM_TYPE_FUNCREF, limits}); + } + for (const InputTable *table : inputTables) writeTableType(os, table->getType()); } diff --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h index 3795b38228d033..7af931b4adc746 100644 --- a/lld/wasm/SyntheticSections.h +++ b/lld/wasm/SyntheticSections.h @@ -98,7 +98,7 @@ class TypeSection : public SyntheticSection { class ImportSection : public SyntheticSection { public: - ImportSection() : SyntheticSection(llvm::wasm::WASM_SEC_IMPORT) {} + ImportSection(); bool isNeeded() const override { return getNumImports() > 0; } void writeBody() override; void addImport(Symbol *sym); @@ -150,7 +150,16 @@ class TableSection : public SyntheticSection { public: TableSection() : SyntheticSection(llvm::wasm::WASM_SEC_TABLE) {} - bool isNeeded() const override { return inputTables.size() > 0; }; + bool isNeeded() const override { + // The linker currently always writes an indirect function table to the + // output, so unless the indirect function table is imported, we need a + // table section. FIXME: Treat __indirect_function_table as a normal + // symbol, and only residualize a table section as needed. + if (!config->importTable) + return true; + return inputTables.size() > 0; + } + void writeBody() override; void addTable(InputTable *table); diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 763fce5a1f3016..99cf48c08c527c 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -745,19 +745,6 @@ void Writer::createCommandExportWrappers() { } } -static void finalizeIndirectFunctionTable() { - if (!WasmSym::indirectFunctionTable) - return; - - uint32_t tableSize = config->tableBase + out.elemSec->numEntries(); - WasmLimits limits = {0, tableSize, 0}; - if (WasmSym::indirectFunctionTable->isDefined() && !config->growableTable) { - limits.Flags |= WASM_LIMITS_FLAG_HAS_MAX; - limits.Maximum = limits.Initial; - } - WasmSym::indirectFunctionTable->setLimits(limits); -} - static void scanRelocations() { for (ObjFile *file : symtab->objectFiles) { LLVM_DEBUG(dbgs() << "scanRelocations: " << file->getName() << "\n"); @@ -805,9 +792,6 @@ void Writer::assignIndexes() { out.tableSec->addTable(table); } - for (InputTable *table : symtab->syntheticTables) - out.tableSec->addTable(table); - out.globalSec->assignIndexes(); } @@ -1357,8 +1341,6 @@ void Writer::run() { log("-- scanRelocations"); scanRelocations(); - log("-- finalizeIndirectFunctionTable"); - finalizeIndirectFunctionTable(); log("-- createSyntheticInitFunctions"); createSyntheticInitFunctions(); log("-- assignIndexes"); diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index c02123b691b5a3..745a9c803db192 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -16,7 +16,7 @@ /* Indicate that this is LLVM compiled from the amd-gfx branch. */ #define LLVM_HAVE_BRANCH_AMD_GFX -#define LLVM_MAIN_REVISION 377173 +#define LLVM_MAIN_REVISION 377177 /* Define if LLVM_ENABLE_DUMP is enabled */ #cmakedefine LLVM_ENABLE_DUMP diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index b2d94dcadd8158..fb41c3763c15a3 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -519,13 +519,6 @@ void WasmObjectWriter::recordRelocation(MCAssembler &Asm, Sym->setUndefined(); } Sym->setUsedInReloc(); - // Any time we have a TABLE_INDEX relocation against a function symbol, we - // need to ensure that table itself is part of the final output too. In the - // future we may want to define a new kind of reloc against both the - // function and the table, so that the linker can see that the function - // symbol keeps the table alive, but for now manually mark the table as - // live. - Sym->setNoStrip(); Asm.registerSymbol(*Sym); } @@ -1677,6 +1670,10 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm, WS.setIndex(InvalidIndex); continue; } + if (WS.isTable() && WS.getName() == "__indirect_function_table") { + // For the moment, don't emit table symbols -- wasm-ld can't handle them. + continue; + } LLVM_DEBUG(dbgs() << "adding to symtab: " << WS << "\n"); uint32_t Flags = 0; diff --git a/llvm/test/MC/RISCV/lit.local.cfg b/llvm/test/MC/RISCV/lit.local.cfg index c63820126f8ca6..896e7941295e36 100644 --- a/llvm/test/MC/RISCV/lit.local.cfg +++ b/llvm/test/MC/RISCV/lit.local.cfg @@ -1,2 +1,10 @@ +from lit.llvm.subst import ToolSubst + if not 'RISCV' in config.root.targets: config.unsupported = True + +fc = ToolSubst('FileCheck', unresolved='fatal') +# Insert this first. Then, we'll first update the blank FileCheck command; then, +# the default substitution of FileCheck will replace it to its full path. +config.substitutions.insert(0, (fc.regex, + 'FileCheck --allow-unused-prefixes=false')) diff --git a/llvm/test/MC/RISCV/rv32c-only-valid.s b/llvm/test/MC/RISCV/rv32c-only-valid.s index edd5a656eeaea3..0b10b3f0e90e1f 100644 --- a/llvm/test/MC/RISCV/rv32c-only-valid.s +++ b/llvm/test/MC/RISCV/rv32c-only-valid.s @@ -1,18 +1,18 @@ # RUN: llvm-mc %s -triple=riscv32 -mattr=+c -riscv-no-aliases -show-encoding \ -# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM %s # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c < %s \ # RUN: | llvm-objdump --mattr=+c -M no-aliases -d -r - \ -# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-OBJ %s # # RUN: not llvm-mc -triple riscv32 \ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ -# RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s +# RUN: | FileCheck --check-prefix=CHECK-NO-EXT %s # RUN: not llvm-mc -triple riscv64 -mattr=+c \ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ -# RUN: | FileCheck -check-prefixes=CHECK-NO-RV32 %s +# RUN: | FileCheck --check-prefix=CHECK-NO-RV32 %s # RUN: not llvm-mc -triple riscv64 \ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ -# RUN: | FileCheck -check-prefixes=CHECK-NO-RV32-AND-EXT %s +# RUN: | FileCheck --check-prefix=CHECK-NO-RV32-AND-EXT %s # CHECK-OBJ: c.jal 0x7fe # CHECK-ASM: c.jal 2046 diff --git a/llvm/test/MC/RISCV/rv32zfh-valid.s b/llvm/test/MC/RISCV/rv32zfh-valid.s index a6853fb95ea036..f257ad0d91fead 100644 --- a/llvm/test/MC/RISCV/rv32zfh-valid.s +++ b/llvm/test/MC/RISCV/rv32zfh-valid.s @@ -4,10 +4,10 @@ # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zfh < %s \ # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \ -# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zfh < %s \ # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \ -# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s # CHECK-ASM-AND-OBJ: flh ft0, 12(a0) # CHECK-ASM: encoding: [0x07,0x10,0xc5,0x00] diff --git a/llvm/test/MC/RISCV/rv64zfh-valid.s b/llvm/test/MC/RISCV/rv64zfh-valid.s index 0a667f668d4fda..49aa4e7aaaefc6 100644 --- a/llvm/test/MC/RISCV/rv64zfh-valid.s +++ b/llvm/test/MC/RISCV/rv64zfh-valid.s @@ -2,7 +2,7 @@ # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zfh < %s \ # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \ -# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s # # RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zfh < %s 2>&1 \ # RUN: | FileCheck -check-prefix=CHECK-RV32 %s diff --git a/llvm/test/MC/WebAssembly/debug-info.ll b/llvm/test/MC/WebAssembly/debug-info.ll index 88d19d9191a99c..167d912c84a2b4 100644 --- a/llvm/test/MC/WebAssembly/debug-info.ll +++ b/llvm/test/MC/WebAssembly/debug-info.ll @@ -89,44 +89,44 @@ ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) -; CHECK-NEXT: Size: 95 +; CHECK-NEXT: Size: 91 ; CHECK-NEXT: Offset: 731 ; CHECK-NEXT: Name: linking ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 9 -; CHECK-NEXT: Offset: 840 +; CHECK-NEXT: Offset: 836 ; CHECK-NEXT: Name: reloc.DATA ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 61 -; CHECK-NEXT: Offset: 866 +; CHECK-NEXT: Offset: 862 ; CHECK-NEXT: Name: reloc..debug_info ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 951 +; CHECK-NEXT: Offset: 947 ; CHECK-NEXT: Name: reloc..debug_pubnames ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 985 +; CHECK-NEXT: Offset: 981 ; CHECK-NEXT: Name: reloc..debug_pubtypes ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 1019 +; CHECK-NEXT: Offset: 1015 ; CHECK-NEXT: Name: reloc..debug_line ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 77 -; CHECK-NEXT: Offset: 1049 +; CHECK-NEXT: Offset: 1045 ; CHECK-NEXT: Name: producers ; CHECK-NEXT: } ; CHECK-NEXT:] @@ -238,16 +238,6 @@ ; CHECK-NEXT: ] ; CHECK-NEXT: ElementIndex: 0xC ; CHECK-NEXT: } -; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: __indirect_function_table -; CHECK-NEXT: Type: TABLE (0x5) -; CHECK-NEXT: Flags [ (0x90) -; CHECK-NEXT: NO_STRIP (0x80) -; CHECK-NEXT: UNDEFINED (0x10) -; CHECK-NEXT: ] -; CHECK-NEXT: ImportModule: env -; CHECK-NEXT: ElementIndex: 0x0 -; CHECK-NEXT: } ; CHECK-NEXT:] ; generated from the following C code using: clang --target=wasm32 -g -O0 -S -emit-llvm test.c diff --git a/llvm/test/MC/WebAssembly/debug-info64.ll b/llvm/test/MC/WebAssembly/debug-info64.ll index 1755f2b7ef5c9e..acba8aa27360e1 100644 --- a/llvm/test/MC/WebAssembly/debug-info64.ll +++ b/llvm/test/MC/WebAssembly/debug-info64.ll @@ -89,44 +89,44 @@ ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) -; CHECK-NEXT: Size: 95 +; CHECK-NEXT: Size: 91 ; CHECK-NEXT: Offset: 759 ; CHECK-NEXT: Name: linking ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 9 -; CHECK-NEXT: Offset: 868 +; CHECK-NEXT: Offset: 864 ; CHECK-NEXT: Name: reloc.DATA ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 61 -; CHECK-NEXT: Offset: 894 +; CHECK-NEXT: Offset: 890 ; CHECK-NEXT: Name: reloc..debug_info ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 979 +; CHECK-NEXT: Offset: 975 ; CHECK-NEXT: Name: reloc..debug_pubnames ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 1013 +; CHECK-NEXT: Offset: 1009 ; CHECK-NEXT: Name: reloc..debug_pubtypes ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 6 -; CHECK-NEXT: Offset: 1047 +; CHECK-NEXT: Offset: 1043 ; CHECK-NEXT: Name: reloc..debug_line ; CHECK-NEXT: } ; CHECK-NEXT: Section { ; CHECK-NEXT: Type: CUSTOM (0x0) ; CHECK-NEXT: Size: 77 -; CHECK-NEXT: Offset: 1077 +; CHECK-NEXT: Offset: 1073 ; CHECK-NEXT: Name: producers ; CHECK-NEXT: } ; CHECK-NEXT: ] @@ -238,16 +238,6 @@ ; CHECK-NEXT: ] ; CHECK-NEXT: ElementIndex: 0xC ; CHECK-NEXT: } -; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: __indirect_function_table -; CHECK-NEXT: Type: TABLE (0x5) -; CHECK-NEXT: Flags [ (0x90) -; CHECK-NEXT: NO_STRIP (0x80) -; CHECK-NEXT: UNDEFINED (0x10) -; CHECK-NEXT: ] -; CHECK-NEXT: ImportModule: env -; CHECK-NEXT: ElementIndex: 0x0 -; CHECK-NEXT: } ; CHECK-NEXT: ] ; generated from the following C code using: clang --target=wasm64 -g -O0 -S -emit-llvm test.c diff --git a/llvm/test/MC/WebAssembly/function-alias.ll b/llvm/test/MC/WebAssembly/function-alias.ll index 8cd42523e4cdaa..ec571083344bc3 100644 --- a/llvm/test/MC/WebAssembly/function-alias.ll +++ b/llvm/test/MC/WebAssembly/function-alias.ll @@ -41,14 +41,4 @@ define i8* @func() { ; CHECK-NEXT: ] ; CHECK-NEXT: ElementIndex: 0x0 ; CHECK-NEXT: } -; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: __indirect_function_table -; CHECK-NEXT: Type: TABLE (0x5) -; CHECK-NEXT: Flags [ (0x90) -; CHECK-NEXT: NO_STRIP (0x80) -; CHECK-NEXT: UNDEFINED (0x10) -; CHECK-NEXT: ] -; CHECK-NEXT: ImportModule: env -; CHECK-NEXT: ElementIndex: 0x0 -; CHECK-NEXT: } ; CHECK-NEXT: ] diff --git a/llvm/test/MC/WebAssembly/global-ctor-dtor.ll b/llvm/test/MC/WebAssembly/global-ctor-dtor.ll index 0de7cfc82c4285..5f56cb6e280dc5 100644 --- a/llvm/test/MC/WebAssembly/global-ctor-dtor.ll +++ b/llvm/test/MC/WebAssembly/global-ctor-dtor.ll @@ -170,11 +170,6 @@ declare void @func3() ; CHECK-NEXT: Name: func0 ; CHECK-NEXT: Flags: [ UNDEFINED ] ; CHECK-NEXT: Function: 4 -; CHECK-NEXT: - Index: 11 -; CHECK-NEXT: Kind: TABLE -; CHECK-NEXT: Name: __indirect_function_table -; CHECK-NEXT: Flags: [ UNDEFINED, NO_STRIP ] -; CHECK-NEXT: Table: 0 ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .data.global1 diff --git a/llvm/test/MC/WebAssembly/reloc-pic.s b/llvm/test/MC/WebAssembly/reloc-pic.s index 1842e9234df041..b7995ebf97fa0c 100644 --- a/llvm/test/MC/WebAssembly/reloc-pic.s +++ b/llvm/test/MC/WebAssembly/reloc-pic.s @@ -190,11 +190,6 @@ hidden_func: # CHECK-NEXT: Name: hidden_func # CHECK-NEXT: Flags: [ BINDING_LOCAL ] # CHECK-NEXT: Function: 5 -# CHECK-NEXT: - Index: 10 -# CHECK-NEXT: Kind: TABLE -# CHECK-NEXT: Name: __indirect_function_table -# CHECK-NEXT: Flags: [ UNDEFINED, NO_STRIP ] -# CHECK-NEXT: Table: 0 # CHECK-NEXT: SegmentInfo: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Name: .rodata.hidden_data diff --git a/llvm/test/MC/WebAssembly/type-index.s b/llvm/test/MC/WebAssembly/type-index.s index dfaaad53506b95..298e5e2f9de328 100644 --- a/llvm/test/MC/WebAssembly/type-index.s +++ b/llvm/test/MC/WebAssembly/type-index.s @@ -66,9 +66,4 @@ test0: # BIN-NEXT: Name: test0 # BIN-NEXT: Flags: [ BINDING_LOCAL ] # BIN-NEXT: Function: 0 -# BIN-NEXT: - Index: 1 -# BIN-NEXT: Kind: TABLE -# BIN-NEXT: Name: __indirect_function_table -# BIN-NEXT: Flags: [ UNDEFINED, NO_STRIP ] -# BIN-NEXT: Table: 0 # BIN-NEXT: ... diff --git a/llvm/test/MC/WebAssembly/weak-alias.s b/llvm/test/MC/WebAssembly/weak-alias.s index 139a681eeea07a..4590e0020382e9 100644 --- a/llvm/test/MC/WebAssembly/weak-alias.s +++ b/llvm/test/MC/WebAssembly/weak-alias.s @@ -227,11 +227,6 @@ alias_address: # CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, NO_STRIP ] # CHECK-NEXT: Segment: 0 # CHECK-NEXT: Size: 4 -# CHECK-NEXT: - Index: 10 -# CHECK-NEXT: Kind: TABLE -# CHECK-NEXT: Name: __indirect_function_table -# CHECK-NEXT: Flags: [ UNDEFINED, NO_STRIP ] -# CHECK-NEXT: Table: 0 # CHECK-NEXT: SegmentInfo: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Name: .data.bar