This is an archive of the discontinued LLVM Phabricator instance.

[libunwind][ARM] Fix VFP build attribute for context save/restore code
Needs ReviewPublic

Authored by olista01 on Jul 18 2016, 7:54 AM.

Details

Summary

These files use VSTM and VLDM instructions to save and restore the
floating-point registers, so the assembler emits the Tag_FP_arch build
attribute, so the resulting object can not be linked for a CPU which
does not have a floating-point unit. This would actually be safe,
because these functions will only be called if the FP registers are
listed in the unwind tables, which can only happen if some other
floating-point code is linked in.

Instead, we need to directly use the encodings of the instructions with
the .inst (or .inst.w) directive.

Diff Detail

Event Timeline

olista01 updated this revision to Diff 64319.Jul 18 2016, 7:54 AM
olista01 retitled this revision from to [libunwind][ARM] Fix VFP build attribute for context save/restore code.
olista01 updated this object.
olista01 added a reviewer: weimingz.
olista01 added a subscriber: llvm-commits.

what about BE32?

clang and gas both emit the correct mapping symbols for the .inst directive, so the object file will be the same except for the build attribute.

rengolin added subscribers: jroelofs, compnerd.

Right. I *really* dislike using the inst directive, but I have no better ideas.

Though, I'd rather @compnerd and @jroelofs could have a look first.

Thanks!

compnerd added inline comments.Aug 7 2016, 10:01 PM
src/UnwindRegistersRestore.S
374

Cant we get away with .feature? IIRC, that doesn't propagate into the build attributes (it is meant for use in such a situation).

olista01 added inline comments.Aug 9 2016, 3:17 AM
src/UnwindRegistersRestore.S
374

Is that an assembler directive? Neither LLVM nor GAS accept it, and I can't find any mention of it in the LLVM source or GAS docs.

compnerd edited edge metadata.Aug 9 2016, 7:55 AM

Ugh, sorry, its spelt .arch_extension, which takes the feature you want to enable.

.arch_extension only accepts a limited set of architectural extensions, not LLVM target features. There is an "fp" extension, but this refers to the fp-armv8 extension, and requires that the target is currently armv8-a.

.arch_extension only accepts a limited set of architectural extensions, not LLVM target features. There is an "fp" extension, but this refers to the fp-armv8 extension, and requires that the target is currently armv8-a.

Weird. It should support "vfpN" and "neon", too. If not, this is a bug in the target parser or the ARM back-end.