[PATCH] D30724: Dont emit Mapping symbols for Non allocatable sections.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 08:50:28 PST 2017


t.p.northover added a comment.

I'm afraid I've spotted a bug in the scheme. If a section starts with data and then gets an instruction there won't be an initial $d:

  .section .debug_info
  .word 42
  ldr r0, [r0]

We want $d at 0 and $a/$t at 4, but I think defaulting to EMS_Data skips the $d.



================
Comment at: lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:479
+    MCSectionELF *CurSection = cast<MCSectionELF>(Section);
+    if (CurSection->UseCodeAlign())
+      LastEMS = EMS_None;
----------------
shankare wrote:
> t.p.northover wrote:
> > Now this is looking a lot more promising! But I don't see the need for any exceptions to an EMS_Data default. That seems to be exactly what the ABI says should happen.
> EmitDataMappingSymbol relies on the value of LastEMS to emit a $d or not. If the stream had any instructions, LastEMS points to what the stream would be (EMS_ARM or EMS_Thumb). 
Yep, I get how it works. But why does an SHF_EXECINSTR section deserve special handling here?

As soon as an instruction is emitted the correct mapping symbol will be put in whether LastEMS was EMS_None or EMS_Data. And if for some strange reason no instruction is emitted, well, that still falls under the ABI permission not to emit mapping symbols.


https://reviews.llvm.org/D30724





More information about the llvm-commits mailing list