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

Side by Side Diff: src/IceAssembler.cpp

Issue 1241313002: Fix --filetype=iasm non-pc-rel fixup offsets (double counted). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/IceELFSection.h » ('j') | src/IceELFSection.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===// 1 //===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===//
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 // 5 //
6 // Modified by the Subzero authors. 6 // Modified by the Subzero authors.
7 // 7 //
8 // This is forked from Dart revision 39313. 8 // This is forked from Dart revision 39313.
9 // Please update the revision if we merge back changes from Dart. 9 // Please update the revision if we merge back changes from Dart.
10 // https://code.google.com/p/dart/wiki/GettingTheSource 10 // https://code.google.com/p/dart/wiki/GettingTheSource
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 intptr_t CurPosition = 0; 125 intptr_t CurPosition = 0;
126 const intptr_t FixupSize = 4; 126 const intptr_t FixupSize = 4;
127 for (const AssemblerFixup *NextFixup : fixups()) { 127 for (const AssemblerFixup *NextFixup : fixups()) {
128 intptr_t NextFixupLoc = NextFixup->position(); 128 intptr_t NextFixupLoc = NextFixup->position();
129 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { 129 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) {
130 Str << "\t.byte 0x"; 130 Str << "\t.byte 0x";
131 Str.write_hex(Buffer.load<uint8_t>(i)); 131 Str.write_hex(Buffer.load<uint8_t>(i));
132 Str << "\n"; 132 Str << "\n";
133 } 133 }
134 Str << "\t.long "; 134 Str << "\t.long ";
135 // For PCRel fixups, we write the pc-offset from a symbol into the Buffer
136 // (e.g., -4), but we don't represent that in the fixup's offset.
137 // Otherwise the fixup holds the true offset, and so does the Buffer.
138 // Just load the offset from the buffer.
135 NextFixup->emit(Ctx, Buffer.load<RelocOffsetT>(NextFixupLoc)); 139 NextFixup->emit(Ctx, Buffer.load<RelocOffsetT>(NextFixupLoc));
136 if (fixupIsPCRel(NextFixup->kind())) 140 if (fixupIsPCRel(NextFixup->kind()))
137 Str << " - ."; 141 Str << " - .";
138 Str << "\n"; 142 Str << "\n";
139 CurPosition = NextFixupLoc + FixupSize; 143 CurPosition = NextFixupLoc + FixupSize;
140 assert(CurPosition <= EndPosition); 144 assert(CurPosition <= EndPosition);
141 } 145 }
142 // Handle any bytes that are not prefixed by a fixup. 146 // Handle any bytes that are not prefixed by a fixup.
143 for (intptr_t i = CurPosition; i < EndPosition; ++i) { 147 for (intptr_t i = CurPosition; i < EndPosition; ++i) {
144 Str << "\t.byte 0x"; 148 Str << "\t.byte 0x";
145 Str.write_hex(Buffer.load<uint8_t>(i)); 149 Str.write_hex(Buffer.load<uint8_t>(i));
146 Str << "\n"; 150 Str << "\n";
147 } 151 }
148 } 152 }
149 153
150 } // end of namespace Ice 154 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceELFSection.h » ('j') | src/IceELFSection.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698