OSDN Git Service

[ARM,AArch64] Do not tail-call to an externally-defined function with weak linkage
authorOliver Stannard <oliver.stannard@arm.com>
Mon, 18 Aug 2014 12:42:15 +0000 (12:42 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Mon, 18 Aug 2014 12:42:15 +0000 (12:42 +0000)
commit802d420792769f789f372748a739aa10feccbb26
treefc8945dcd625ffc798331eda3e796ce4332509e0
parent9735ccb7ead8598fded49a5ce2f0caf978afcccd
[ARM,AArch64] Do not tail-call to an externally-defined function with weak linkage

Externally-defined functions with weak linkage should not be
tail-called on ARM or AArch64, as the AAELF spec requires normal calls
to undefined weak functions to be replaced with a NOP or jump to the
next instruction. The behaviour of branch instructions in this
situation (as used for tail calls) is implementation-defined, so we
cannot rely on the linker replacing the tail call with a return.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215890 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64ISelLowering.cpp
lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/AArch64/tail-call.ll
test/CodeGen/ARM/tail-call.ll