@@ -278,76 +278,58 @@ void MCWinCOFFStreamer::emitCOFFSymbolIndex(MCSymbol const *Symbol) {
278278
279279void MCWinCOFFStreamer::emitCOFFSectionIndex (const MCSymbol *Symbol) {
280280 visitUsedSymbol (*Symbol);
281- MCFragment *DF = getCurrentFragment ();
282281 const MCSymbolRefExpr *SRE = MCSymbolRefExpr::create (Symbol, getContext ());
283- MCFixup Fixup = MCFixup::create (DF->getContents ().size (), SRE, FK_SecRel_2);
284- DF->addFixup (Fixup);
285- DF->appendContents (2 , 0 );
282+ addFixup (SRE, FK_SecRel_2);
283+ appendContents (2 , 0 );
286284}
287285
288286void MCWinCOFFStreamer::emitCOFFSecRel32 (const MCSymbol *Symbol,
289287 uint64_t Offset) {
290288 visitUsedSymbol (*Symbol);
291- MCFragment *DF = getCurrentFragment ();
292289 // Create Symbol A for the relocation relative reference.
293290 const MCExpr *MCE = MCSymbolRefExpr::create (Symbol, getContext ());
294291 // Add the constant offset, if given.
295292 if (Offset)
296293 MCE = MCBinaryExpr::createAdd (
297294 MCE, MCConstantExpr::create (Offset, getContext ()), getContext ());
298- // Build the secrel32 relocation.
299- MCFixup Fixup = MCFixup::create (DF->getContents ().size (), MCE, FK_SecRel_4);
300- // Record the relocation.
301- DF->addFixup (Fixup);
295+ addFixup (MCE, FK_SecRel_4);
302296 // Emit 4 bytes (zeros) to the object file.
303- DF-> appendContents (4 , 0 );
297+ appendContents (4 , 0 );
304298}
305299
306300void MCWinCOFFStreamer::emitCOFFImgRel32 (const MCSymbol *Symbol,
307301 int64_t Offset) {
308302 visitUsedSymbol (*Symbol);
309- MCFragment *DF = getCurrentFragment ();
310303 // Create Symbol A for the relocation relative reference.
311304 const MCExpr *MCE = MCSymbolRefExpr::create (
312305 Symbol, MCSymbolRefExpr::VK_COFF_IMGREL32, getContext ());
313306 // Add the constant offset, if given.
314307 if (Offset)
315308 MCE = MCBinaryExpr::createAdd (
316309 MCE, MCConstantExpr::create (Offset, getContext ()), getContext ());
317- // Build the imgrel relocation.
318- MCFixup Fixup = MCFixup::create (DF->getContents ().size (), MCE, FK_Data_4);
319- // Record the relocation.
320- DF->addFixup (Fixup);
310+ addFixup (MCE, FK_Data_4);
321311 // Emit 4 bytes (zeros) to the object file.
322- DF-> appendContents (4 , 0 );
312+ appendContents (4 , 0 );
323313}
324314
325315void MCWinCOFFStreamer::emitCOFFSecNumber (MCSymbol const *Symbol) {
326316 visitUsedSymbol (*Symbol);
327- MCFragment *DF = getCurrentFragment ();
328317 // Create Symbol for section number.
329318 const MCExpr *MCE = MCCOFFSectionNumberTargetExpr::create (
330319 *Symbol, this ->getWriter (), getContext ());
331- // Build the relocation.
332- MCFixup Fixup = MCFixup::create (DF->getContents ().size (), MCE, FK_Data_4);
333- // Record the relocation.
334- DF->addFixup (Fixup);
320+ addFixup (MCE, FK_Data_4);
335321 // Emit 4 bytes (zeros) to the object file.
336- DF-> appendContents (4 , 0 );
322+ appendContents (4 , 0 );
337323}
338324
339325void MCWinCOFFStreamer::emitCOFFSecOffset (MCSymbol const *Symbol) {
340326 visitUsedSymbol (*Symbol);
341- MCFragment *DF = getCurrentFragment ();
342327 // Create Symbol for section offset.
343328 const MCExpr *MCE =
344329 MCCOFFSectionOffsetTargetExpr::create (*Symbol, getContext ());
345- // Build the relocation.
346- MCFixup Fixup = MCFixup::create (DF->getContents ().size (), MCE, FK_Data_4);
347- // Record the relocation.
348- DF->addFixup (Fixup);
330+ addFixup (MCE, FK_Data_4);
349331 // Emit 4 bytes (zeros) to the object file.
350- DF-> appendContents (4 , 0 );
332+ appendContents (4 , 0 );
351333}
352334
353335void MCWinCOFFStreamer::emitCommonSymbol (MCSymbol *S, uint64_t Size,
0 commit comments