|
12 | 12 |
|
13 | 13 | #include "llvm/BinaryFormat/GOFF.h" |
14 | 14 | #include "llvm/MC/MCAssembler.h" |
15 | | -#include "llvm/MC/MCGOFFObjectWriter.h" |
16 | 15 | #include "llvm/MC/MCGOFFAttributes.h" |
| 16 | +#include "llvm/MC/MCGOFFObjectWriter.h" |
17 | 17 | #include "llvm/MC/MCSectionGOFF.h" |
18 | 18 | #include "llvm/MC/MCValue.h" |
19 | 19 | #include "llvm/Support/Casting.h" |
@@ -310,67 +310,71 @@ class GOFFWriter { |
310 | 310 | GOFFWriter::GOFFWriter(raw_pwrite_stream &OS, MCAssembler &Asm) |
311 | 311 | : OS(OS), Asm(Asm) {} |
312 | 312 |
|
313 | | -GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, const GOFF::SDAttr &Attr) { |
| 313 | +GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, |
| 314 | + const GOFF::SDAttr &Attr) { |
314 | 315 | return GOFFSymbol(Name, ++EsdIdCounter, Attr); |
315 | 316 | } |
316 | 317 |
|
317 | | -GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, const GOFF::EDAttr &Attr, |
| 318 | +GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, |
| 319 | + const GOFF::EDAttr &Attr, |
318 | 320 | uint32_t ParentEsdId) { |
319 | 321 | return GOFFSymbol(Name, ++EsdIdCounter, ParentEsdId, Attr); |
320 | 322 | } |
321 | 323 |
|
322 | | -GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, const GOFF::LDAttr &Attr, |
| 324 | +GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, |
| 325 | + const GOFF::LDAttr &Attr, |
323 | 326 | uint32_t ParentEsdId) { |
324 | 327 | return GOFFSymbol(Name, ++EsdIdCounter, ParentEsdId, Attr); |
325 | 328 | } |
326 | 329 |
|
327 | | -GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, const GOFF::PRAttr &Attr, |
| 330 | +GOFFSymbol GOFFWriter::createGOFFSymbol(StringRef Name, |
| 331 | + const GOFF::PRAttr &Attr, |
328 | 332 | uint32_t ParentEsdId) { |
329 | 333 | return GOFFSymbol(Name, ++EsdIdCounter, ParentEsdId, Attr); |
330 | 334 | } |
331 | 335 |
|
332 | 336 | void GOFFWriter::defineSectionSymbols(const MCSectionGOFF &Section) { |
333 | | - uint32_t SDEsdId = RootSDEsdId; |
334 | | - if (!Section.usesRootSD()) { |
335 | | - GOFFSymbol SD = |
336 | | - createGOFFSymbol(Section.getSDName(), Section.getSDAttributes()); |
337 | | - SDEsdId = SD.EsdId; |
338 | | - if (RootSDEsdId == 0) |
339 | | - RootSDEsdId = SDEsdId; |
340 | | - writeSymbol(SD); |
341 | | - } |
| 337 | + uint32_t SDEsdId = RootSDEsdId; |
| 338 | + if (!Section.usesRootSD()) { |
| 339 | + GOFFSymbol SD = |
| 340 | + createGOFFSymbol(Section.getSDName(), Section.getSDAttributes()); |
| 341 | + SDEsdId = SD.EsdId; |
| 342 | + if (RootSDEsdId == 0) |
| 343 | + RootSDEsdId = SDEsdId; |
| 344 | + writeSymbol(SD); |
| 345 | + } |
342 | 346 |
|
343 | | - GOFFSymbol ED = createGOFFSymbol(Section.getEDName(), |
344 | | - Section.getEDAttributes(), SDEsdId); |
345 | | - if ((!Section.hasLD() && !Section.hasPR()) || Section.hasLD()) { |
346 | | - ED.SectionLength = Asm.getSectionAddressSize(Section); |
347 | | - } |
348 | | - writeSymbol(ED); |
349 | | - |
350 | | - if (Section.hasLD()) { |
351 | | - GOFFSymbol LD = createGOFFSymbol(Section.getLDorPRName(), |
352 | | - Section.getLDAttributes(), ED.EsdId); |
353 | | - if (Section.isText()) |
354 | | - LD.ADAEsdId = ADAEsdId; |
355 | | - writeSymbol(LD); |
356 | | - } |
| 347 | + GOFFSymbol ED = |
| 348 | + createGOFFSymbol(Section.getEDName(), Section.getEDAttributes(), SDEsdId); |
| 349 | + if ((!Section.hasLD() && !Section.hasPR()) || Section.hasLD()) { |
| 350 | + ED.SectionLength = Asm.getSectionAddressSize(Section); |
| 351 | + } |
| 352 | + writeSymbol(ED); |
| 353 | + |
| 354 | + if (Section.hasLD()) { |
| 355 | + GOFFSymbol LD = createGOFFSymbol(Section.getLDorPRName(), |
| 356 | + Section.getLDAttributes(), ED.EsdId); |
| 357 | + if (Section.isText()) |
| 358 | + LD.ADAEsdId = ADAEsdId; |
| 359 | + writeSymbol(LD); |
| 360 | + } |
357 | 361 |
|
358 | | - if (Section.hasPR()) { |
359 | | - GOFFSymbol PR = createGOFFSymbol(Section.getLDorPRName(), |
360 | | - Section.getPRAttributes(), ED.EsdId); |
361 | | - PR.SectionLength = Asm.getSectionAddressSize(Section); |
362 | | - if (&Section == ADA) { |
363 | | - // We cannot have a zero-length section for data. If we do, |
364 | | - // artificially inflate it. Use 2 bytes to avoid odd alignments. Note: |
365 | | - // if this is ever changed, you will need to update the code in |
366 | | - // SystemZAsmPrinter::emitCEEMAIN and SystemZAsmPrinter::emitCELQMAIN to |
367 | | - // generate -1 if there is no ADA |
368 | | - if (!PR.SectionLength) |
369 | | - PR.SectionLength = 2; |
370 | | - ADAEsdId = PR.EsdId; |
371 | | - } |
372 | | - writeSymbol(PR); |
| 362 | + if (Section.hasPR()) { |
| 363 | + GOFFSymbol PR = createGOFFSymbol(Section.getLDorPRName(), |
| 364 | + Section.getPRAttributes(), ED.EsdId); |
| 365 | + PR.SectionLength = Asm.getSectionAddressSize(Section); |
| 366 | + if (&Section == ADA) { |
| 367 | + // We cannot have a zero-length section for data. If we do, |
| 368 | + // artificially inflate it. Use 2 bytes to avoid odd alignments. Note: |
| 369 | + // if this is ever changed, you will need to update the code in |
| 370 | + // SystemZAsmPrinter::emitCEEMAIN and SystemZAsmPrinter::emitCELQMAIN to |
| 371 | + // generate -1 if there is no ADA |
| 372 | + if (!PR.SectionLength) |
| 373 | + PR.SectionLength = 2; |
| 374 | + ADAEsdId = PR.EsdId; |
373 | 375 | } |
| 376 | + writeSymbol(PR); |
| 377 | + } |
374 | 378 | } |
375 | 379 |
|
376 | 380 | void GOFFWriter::defineSymbols() { |
|
0 commit comments