From 67144e37ba5cd35ee917daac631e03963b05a674 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 15 Feb 2013 22:50:52 +0000 Subject: If bundle alignment is enabled, do not add data to a fragment with instructions With bundle alignment, instructions all get their own MCFragments (unless they are in a bundle-locked group). For instructions with fixups, this is an MCDataFragment. Emitting actual data (e.g. for .long) attempts to re-use MCDataFragments, which we don't want int this case since it leads to fragments which exceed the bundle size. So, don't reuse them in this case. Also adds a test and fixes some formatting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175316 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCObjectStreamer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/MC/MCObjectStreamer.cpp') diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index fe43506..b6c7341 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -59,7 +59,9 @@ MCFragment *MCObjectStreamer::getCurrentFragment() const { MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const { MCDataFragment *F = dyn_cast_or_null(getCurrentFragment()); - if (!F) + // When bundling is enabled, we don't want to add data to a fragment that + // already has instructions (see MCELFStreamer::EmitInstToData for details) + if (!F || (Assembler->isBundlingEnabled() && F->hasInstructions())) F = new MCDataFragment(getCurrentSectionData()); return F; } -- cgit v1.1