diff options
| author | Fangrui Song <maskray@google.com> | 2020-01-05 14:02:18 -0800 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2020-01-05 14:20:34 -0800 |
| commit | 5511861e6dc81e702587bb4d07deba35571db293 (patch) | |
| tree | f08770941983dfe5cb71eb6b45afe06172017431 /llvm/lib/Target/ARM | |
| parent | 35efef5351e3b3a4e50bcd862407ef7edc0b2166 (diff) | |
| download | bcm5719-llvm-5511861e6dc81e702587bb4d07deba35571db293.tar.gz bcm5719-llvm-5511861e6dc81e702587bb4d07deba35571db293.zip | |
[MC][ARM] Delete MCSection::HasData and move SHF_ARM_PURECODE logic to ARMELFObjectWriter::addTargetSectionFlags
This simplifies the generic interface and also makes SHF_ARM_PURECODE
more robust (fixes a TODO). Inspecting MCDataFragment contents covers
more cases than MCObjectStreamer::EmitBytes.
Diffstat (limited to 'llvm/lib/Target/ARM')
| -rw-r--r-- | llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp index 1fee38821a4..2c26dd388c0 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp @@ -255,8 +255,11 @@ void ARMELFObjectWriter::addTargetSectionFlags(MCContext &Ctx, // execute-only section in the object. MCSectionELF *TextSection = static_cast<MCSectionELF *>(Ctx.getObjectFileInfo()->getTextSection()); - if (Sec.getKind().isExecuteOnly() && !TextSection->hasInstructions() && - !TextSection->hasData()) { + if (Sec.getKind().isExecuteOnly() && !TextSection->hasInstructions()) { + for (auto &F : TextSection->getFragmentList()) + if (auto *DF = dyn_cast<MCDataFragment>(&F)) + if (!DF->getContents().empty()) + return; TextSection->setFlags(TextSection->getFlags() | ELF::SHF_ARM_PURECODE); } } |

