Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(767)

Unified Diff: lib/MC/MCObjectStreamer.cpp

Issue 1133723005: Cherry-pick r234714: [MC] Write padding into fragments when -mc-relax-all flag is used (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/MC/MCELFStreamer.cpp ('k') | test/MC/X86/AlignedBundling/bundle-group-too-large-error.s » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/MC/MCObjectStreamer.cpp
diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp
index 73480dc73c025f5471d918410afb865ecf616d13..6b6bf33130358d1d2cfc1a030a450d02bd1941c3 100644
--- a/lib/MC/MCObjectStreamer.cpp
+++ b/lib/MC/MCObjectStreamer.cpp
@@ -42,7 +42,7 @@ MCObjectStreamer::~MCObjectStreamer() {
delete Assembler;
}
-void MCObjectStreamer::flushPendingLabels(MCFragment *F) {
+void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) {
if (PendingLabels.size()) {
if (!F) {
F = new MCDataFragment();
@@ -51,7 +51,7 @@ void MCObjectStreamer::flushPendingLabels(MCFragment *F) {
}
for (MCSymbolData *SD : PendingLabels) {
SD->setFragment(F);
- SD->setOffset(0);
+ SD->setOffset(FOffset);
}
PendingLabels.clear();
}
@@ -92,7 +92,8 @@ MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() {
MCDataFragment *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
// 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())) {
+ if (!F || (Assembler->isBundlingEnabled() && !Assembler->getRelaxAll() &&
+ F->hasInstructions())) {
F = new MCDataFragment();
insert(F);
}
@@ -148,7 +149,9 @@ void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
// If there is a current fragment, mark the symbol as pointing into it.
// Otherwise queue the label and set its fragment pointer when we emit the
// next fragment.
- if (auto *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment())) {
+ auto *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
+ if (F && !(getAssembler().isBundlingEnabled() &&
+ getAssembler().getRelaxAll())) {
SD.setFragment(F);
SD.setOffset(F->getContents().size());
} else {
@@ -247,6 +250,9 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst,
void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst,
const MCSubtargetInfo &STI) {
+ if (getAssembler().getRelaxAll() && getAssembler().isBundlingEnabled())
+ llvm_unreachable("All instructions should have already been relaxed");
+
// Always create a new, separate fragment here, because its size can change
// during relaxation.
MCRelaxableFragment *IF = new MCRelaxableFragment(Inst, STI);
« no previous file with comments | « lib/MC/MCELFStreamer.cpp ('k') | test/MC/X86/AlignedBundling/bundle-group-too-large-error.s » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698