[WebAssembly] Fix list of relocations with addends in lld

Summary:
The list of relocations with addend in lld was missing `R_WASM_MEMORY_ADDR_REL_SLEB`,
causing `wasm-ld` to generate corrupted output. This fixes that problem and while
we're at it pulls the list of such relocations into the Wasm.h header, to avoid
duplicating it in multiple places.

Reviewers: sbc100
Differential Revision: https://reviews.llvm.org/D63696

llvm-svn: 364367
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index 735eb77..efb8d31 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -154,15 +154,8 @@
     writeUleb128(OS, Rel.Offset + Off, "reloc offset");
     writeUleb128(OS, File->calcNewIndex(Rel), "reloc index");
 
-    switch (Rel.Type) {
-    case R_WASM_MEMORY_ADDR_LEB:
-    case R_WASM_MEMORY_ADDR_SLEB:
-    case R_WASM_MEMORY_ADDR_I32:
-    case R_WASM_FUNCTION_OFFSET_I32:
-    case R_WASM_SECTION_OFFSET_I32:
+    if (relocTypeHasAddend(Rel.Type))
       writeSleb128(OS, File->calcNewAddend(Rel), "reloc addend");
-      break;
-    }
   }
 }