[PATCH] [ARM] Emit Tag_conformance.

Charlie Turner charlie.turner at arm.com
Fri Dec 12 09:22:31 PST 2014


This tag should be emitted first in a file-scope sub-subsection of the
first public subsection of the attributes section (2.3.7.4 of ABI
Addenda). To satisfy this requirement, the tag must be special cased
in the ARMELFStreamer.

ARMTargetELFStreamer::setAttributeItem has been modified to intercept
calls for caching the Tag_conformance build attribute. Instead, the
string representation of the conformance level is now saved in the
ARMTargetELFStreamer class for being special-cased later.

ARMTargetELFStreamer::finishAttributeSection then checks if
Tag_conformance has been intercepted and emits it first in a
file-scope sub-subsection of the first public subsection of the
attributes section. Since the tag is now intercepted,
calculateContentSize() will no longer account for the conformance tag,
so this is also special-cased with this patch.

test/CodeGen/ARM/build-attributes.ll has a lone test in the V8 section
to see if the tag is emitted by default. It didn't seem worth
replicating this check for every CPU / arch in that test file because
it's independent of the target and other command-line options.

test/MC/ARM/directive-eabi_attribute.s has been updated to check that
Tag_conformance is emitted first in the list of build attributes,
rather than in the original numerical order.

A new test has been added in llvm-readobj/ARM/attribute-conformance.s
as a sanity check. This test is the reason if (Contents.empty()) was
changed to if (Contents.empty() && !EmitConformance).

An alternative implementation that doesn't intercept Tag_conformance
that I considered only required changes to
ARMTargetELFStreamer::finishAttributeSection. The idea was to search
the Contents vector for Tag_conformance, and if found do the special
casing above. This would mean adding a check in the loop around line
991 of ARMELFStreamer.cpp like,

  if (item.Tag == ARMBuildAttrs::conformance)
    continue;

but would avoid adding extra class fields and special casing the
computation of ContentsSize.

I wasn't sure which implementation to go with.

Thank you for your time,
Charlie.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6643

Files:
  lib/Target/ARM/ARMAsmPrinter.cpp
  lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
  test/CodeGen/ARM/build-attributes.ll
  test/MC/ARM/directive-eabi_attribute.s
  test/tools/llvm-readobj/ARM/attribute-conformance.s

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6643.17238.patch
Type: text/x-patch
Size: 4888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141212/f7a6fc93/attachment.bin>


More information about the llvm-commits mailing list