[PATCH] D34734: [WebAssembly] MC: Don't generate extra types for weak alias

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 13:10:03 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL307194: [WebAssembly] MC: Don't generate extra types for weak alias (authored by sbc).

Repository:
  rL LLVM

https://reviews.llvm.org/D34734

Files:
  llvm/trunk/include/llvm/BinaryFormat/Wasm.h
  llvm/trunk/lib/MC/WasmObjectWriter.cpp
  llvm/trunk/test/MC/WebAssembly/weak-alias.ll


Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp
@@ -959,6 +959,10 @@
 
   // 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;
 
Index: llvm/trunk/include/llvm/BinaryFormat/Wasm.h
===================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Wasm.h
+++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h
@@ -107,7 +107,7 @@
 
 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.
 };
Index: llvm/trunk/test/MC/WebAssembly/weak-alias.ll
===================================================================
--- llvm/trunk/test/MC/WebAssembly/weak-alias.ll
+++ llvm/trunk/test/MC/WebAssembly/weak-alias.ll
@@ -10,6 +10,14 @@
   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 @@
 ; CHECK-NEXT:         Kind:            FUNCTION
 ; CHECK-NEXT:         Index:           0
 
-
 ; CHECK:        - Type:            CUSTOM
 ; CHECK-NEXT:     Name:            name
 ; CHECK-NEXT:     FunctionNames:   


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34734.105322.patch
Type: text/x-patch
Size: 1953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170705/10f41b87/attachment.bin>


More information about the llvm-commits mailing list