[WebAssembly] Fix validation of start function

The check for valid start function was inverted.  Added a new
test in test/Object to check this case and fixed the existing
tests in for ObjectYAML.

Differential Revision: https://reviews.llvm.org/D32986

llvm-svn: 302560
diff --git a/llvm/test/Object/wasm-invalid-start.test b/llvm/test/Object/wasm-invalid-start.test
new file mode 100644
index 0000000..12f7567
--- /dev/null
+++ b/llvm/test/Object/wasm-invalid-start.test
@@ -0,0 +1,10 @@
+# RUN: yaml2obj %s | not llvm-objdump -h - 2>&1 | FileCheck %s
+
+!WASM
+FileHeader:
+  Version:         0x00000001
+Sections:
+  - Type:            START
+    StartFunction:   0
+
+# CHECK: {{.*}}: Invalid start function
diff --git a/llvm/test/ObjectYAML/wasm/function_section.yaml b/llvm/test/ObjectYAML/wasm/function_section.yaml
index 39e6b75..571b762 100644
--- a/llvm/test/ObjectYAML/wasm/function_section.yaml
+++ b/llvm/test/ObjectYAML/wasm/function_section.yaml
@@ -4,9 +4,7 @@
   Version:         0x00000001
 Sections:
   - Type:            FUNCTION
-    FunctionTypes:   
-      - 1
-      - 0
+    FunctionTypes: [ 1, 0 ]
 ...
 # CHECK: --- !WASM
 # CHECK: FileHeader:
diff --git a/llvm/test/ObjectYAML/wasm/start_section.yaml b/llvm/test/ObjectYAML/wasm/start_section.yaml
index 41301a6..38feebc 100644
--- a/llvm/test/ObjectYAML/wasm/start_section.yaml
+++ b/llvm/test/ObjectYAML/wasm/start_section.yaml
@@ -1,8 +1,17 @@
 # RUN: yaml2obj %s | obj2yaml | FileCheck %s
+
 --- !WASM
 FileHeader:
   Version:         0x00000001
 Sections:
+  - Type:            TYPE
+    Signatures:
+      - ReturnType:      I32
+        ParamTypes:
+          - F32
+          - F32
+  - Type:            FUNCTION
+    FunctionTypes: [ 0, 0, 0 ]
   - Type:            START
     StartFunction:   1
 ...