[llvm-commits] [llvm] r111376 - in /llvm/trunk: lib/MC/MCAssembler.cpp test/MC/ELF/ test/MC/ELF/bss.ll test/MC/ELF/dg.exp
Daniel Dunbar
daniel at zuster.org
Wed Aug 18 11:22:37 PDT 2010
Author: ddunbar
Date: Wed Aug 18 13:22:37 2010
New Revision: 111376
URL: http://llvm.org/viewvc/llvm-project?rev=111376&view=rev
Log:
MC/ELF: Allow null values in virtual sections, ELF doesn't use special
directives for putting contents in .bss, for example.
Added:
llvm/trunk/test/MC/ELF/
llvm/trunk/test/MC/ELF/bss.ll
llvm/trunk/test/MC/ELF/dg.exp
Modified:
llvm/trunk/lib/MC/MCAssembler.cpp
Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=111376&r1=111375&r2=111376&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Wed Aug 18 13:22:37 2010
@@ -628,8 +628,23 @@
switch (it->getKind()) {
default:
assert(0 && "Invalid fragment in virtual section!");
+ case MCFragment::FT_Data: {
+ // Check that we aren't trying to write a non-zero contents (or fixups)
+ // into a virtual section. This is to support clients which use standard
+ // directives to fill the contents of virtual sections.
+ MCDataFragment &DF = cast<MCDataFragment>(*it);
+ assert(DF.fixup_begin() == DF.fixup_end() &&
+ "Cannot have fixups in virtual section!");
+ for (unsigned i = 0, e = DF.getContents().size(); i != e; ++i)
+ assert(DF.getContents()[i] == 0 &&
+ "Invalid data value for virtual section!");
+ break;
+ }
case MCFragment::FT_Align:
- assert(!cast<MCAlignFragment>(it)->getValueSize() &&
+ // Check that we aren't trying to write a non-zero value into a virtual
+ // section.
+ assert((!cast<MCAlignFragment>(it)->getValueSize() ||
+ !cast<MCAlignFragment>(it)->getValue()) &&
"Invalid align in virtual section!");
break;
case MCFragment::FT_Fill:
Added: llvm/trunk/test/MC/ELF/bss.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/bss.ll?rev=111376&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/bss.ll (added)
+++ llvm/trunk/test/MC/ELF/bss.ll Wed Aug 18 13:22:37 2010
@@ -0,0 +1,8 @@
+; RUN: llc -filetype=obj %s -o %t
+; FIXME: Add ELF dumping tool to check results.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
+target triple = "i386-pc-linux-gnu"
+
+ at g0 = global i8* null, align 4 ; <i8**> [#uses=0]
+
Added: llvm/trunk/test/MC/ELF/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/dg.exp?rev=111376&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/dg.exp (added)
+++ llvm/trunk/test/MC/ELF/dg.exp Wed Aug 18 13:22:37 2010
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if { [llvm_supports_target X86] } {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll}]]
+}
More information about the llvm-commits
mailing list