This is an archive of the discontinued LLVM Phabricator instance.

[ARM] ARM attribute parser incorrectly handles CPU_arch_profile
ClosedPublic

Authored by chatur01 on Nov 20 2014, 8:57 AM.

Details

Reviewers
t.p.northover
Summary

The method ARMAttributeParser::CPU_arch_profile in llvm/tools/llvm-readobj/ARMAttributeParser.cpp incorrectly switches on the value '0' for an encoded argument to CPU_arch_profile. This looks like a typo. From the ABI spec, the valid values for this tag are,

Tag_CPU_arch_profile (=7), uleb128
0 Architecture profile is not applicable (e.g. pre v7, or cross-profile code)
'A' (0x41) The application profile (e.g. for Cortex A8)
'R' (0x52) The real-time profile (e.g. for Cortex R4)
'M' (0x4D) The microcontroller profile (e.g. for Cortex M3)
’S’ (0x53) Application or real-time profile (i.e. the ‘classic’ programmer’s model)

Note that 0 is not a character literal.

Diff Detail

Event Timeline

chatur01 retitled this revision from to [ARM] ARM attribute parser incorrectly handles CPU_arch_profile.
chatur01 updated this object.
chatur01 edited the test plan for this revision. (Show Details)
chatur01 set the repository for this revision to rL LLVM.
chatur01 added a subscriber: Unknown Object (MLST).

Hi Charlie,

Shouldn't this be testable?

Cheers.

Tim.

Hi Tim, thanks for taking a look!

Shouldn't this be testable?

It is, as I mention in the test plan, the large suite of tests I have in D6319 will cover this attribute for all permissible values. It is those tests that uncovered this bug. I would like to fix this first to avoid an erroneous test failure when D6319 is committed.

Kind regards,
Charlie.

t.p.northover accepted this revision.Nov 24 2014, 1:35 PM
t.p.northover added a reviewer: t.p.northover.

OK, fair enough. The change is obviously correct.

Cheers.

Tim.

This revision is now accepted and ready to land.Nov 24 2014, 1:35 PM

Thanks for the review Tim, committed as r222743.

Regards,
Charlie.