[llvm] r307194 - [WebAssembly] MC: Don't generate extra types for weak alias
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 5 13:09:26 PDT 2017
Author: sbc
Date: Wed Jul 5 13:09:26 2017
New Revision: 307194
URL: http://llvm.org/viewvc/llvm-project?rev=307194&view=rev
Log:
[WebAssembly] MC: Don't generate extra types for weak alias
Previously we were generating a void(void) function type
for a weak alias. Update the weak-alias test case to
catch this.
Differential Revision: https://reviews.llvm.org/D34734
Modified:
llvm/trunk/include/llvm/BinaryFormat/Wasm.h
llvm/trunk/lib/MC/WasmObjectWriter.cpp
llvm/trunk/test/MC/WebAssembly/weak-alias.ll
Modified: llvm/trunk/include/llvm/BinaryFormat/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Wasm.h?rev=307194&r1=307193&r2=307194&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Wasm.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h Wed Jul 5 13:09:26 2017
@@ -107,7 +107,7 @@ struct WasmElemSegment {
struct WasmRelocation {
uint32_t Type; // The type of the relocation.
- int32_t Index; // Index into function to global index space.
+ uint32_t Index; // Index into function to global index space.
uint64_t Offset; // Offset from the start of the section.
int64_t Addend; // A value to add to the symbol.
};
Modified: llvm/trunk/lib/MC/WasmObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WasmObjectWriter.cpp?rev=307194&r1=307193&r2=307194&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp Wed Jul 5 13:09:26 2017
@@ -959,6 +959,10 @@ void WasmObjectWriter::writeObject(MCAss
// Populate the Imports set.
for (const MCSymbol &S : Asm.symbols()) {
+ // Weak aliases don't have thier own function types.
+ if (S.isVariable())
+ continue;
+
const auto &WS = static_cast<const MCSymbolWasm &>(S);
int32_t Type;
Modified: llvm/trunk/test/MC/WebAssembly/weak-alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/weak-alias.ll?rev=307194&r1=307193&r2=307194&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/weak-alias.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/weak-alias.ll Wed Jul 5 13:09:26 2017
@@ -10,6 +10,14 @@ entry:
ret i32 0
}
+; CHECK: - Type: TYPE
+; CHECK-NEXT: Signatures:
+; CHECK-NEXT: - Index: 0
+; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ParamTypes:
+; CHECK-NEXT: - Type: FUNCTION
+; CHECK-NEXT: FunctionTypes: [ 0 ]
+
; CHECK: - Type: EXPORT
; CHECK-NEXT: Exports:
; CHECK-NEXT: - Name: foo
@@ -19,7 +27,6 @@ entry:
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 0
-
; CHECK: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
More information about the llvm-commits
mailing list