This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, ARM] Implement __builtin_trap


On 04/12/13 16:05, Ian Bolton wrote:
Hi,

Currently, on ARM, you have to either call abort() or raise(SIGTRAP)
to achieve a handy crash.

This patch allows you to instead call __builtin_trap() which is much
more efficient at falling over because it becomes just a single
instruction that will trap for you.

Two testcases have been added (for ARM and Thumb) and both pass.


Note: This is a modified version of a patch originally submitted by Mark
Mitchell back in 2010, which came in response to PR target/59091.

The PR came as a result of the A64 implementation of __builtin_trap. The original patch was much earlier than that :)


http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00639.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59091

The main update, other than cosmetic differences, is that we've chosen
the same ARM encoding as LLVM for practical purposes.  (The Thumb
encoding in Mark's patch already matched LLVM.)


OK for trunk?

This is OK for trunk. Please put the PR numbers in the changelog entries before committing i.e. PR target/59091.

FTR, these match with the encodings for the udf mnemonic with an immediate value of 0 in ARM state and #0xff in Thumb state. Obviously we cannot put out the udf mnemonic out because an older gas will not support it. These immediates were chosen to match the values as in other compiler implementations (I know these match with LLVM as something I can point to externally) and have been double checked with folks who have an avid interest in the kernel world.

Thanks,
Ramana



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]