[PATCH] D67997: [MC][WebAssembly] Error on data symbols in the text section.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 16:31:37 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372934: [MC][WebAssembly] Error on data symbols in the text section. (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67997?vs=221623&id=221861#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67997/new/

https://reviews.llvm.org/D67997

Files:
  llvm/trunk/lib/MC/WasmObjectWriter.cpp
  llvm/trunk/test/MC/WebAssembly/data-symbol-in-text-section.ll


Index: llvm/trunk/test/MC/WebAssembly/data-symbol-in-text-section.ll
===================================================================
--- llvm/trunk/test/MC/WebAssembly/data-symbol-in-text-section.ll
+++ llvm/trunk/test/MC/WebAssembly/data-symbol-in-text-section.ll
@@ -0,0 +1,13 @@
+; RUN: not llc -filetype=obj %s -o /dev/null 2>&1 | FileCheck %s
+; CHECK: data symbols must live in a data section: data_symbol
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+ at data_symbol = constant [1024 x i32] zeroinitializer, section ".text", align 16
+
+define hidden i32 @main() local_unnamed_addr #0 {
+entry:
+  %0 = load i32, i32* getelementptr inbounds ([1024 x i32], [1024 x i32]* @data_symbol, i32 0, i32 10)
+  ret i32 %0
+}
Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp
@@ -1350,7 +1350,9 @@
         report_fatal_error(".size expression must be evaluatable");
 
       auto &DataSection = static_cast<MCSectionWasm &>(WS.getSection());
-      assert(DataSection.isWasmData());
+      if (!DataSection.isWasmData())
+        report_fatal_error("data symbols must live in a data section: " +
+                           WS.getName());
 
       // For each data symbol, export it in the symtab as a reference to the
       // corresponding Wasm data segment.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67997.221861.patch
Type: text/x-patch
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190925/ce6f3ed5/attachment-0001.bin>


More information about the llvm-commits mailing list