aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM
diff options
context:
space:
mode:
authorLogan Chien <tzuhsiang.chien@gmail.com>2013-07-02 12:43:27 +0000
committerLogan Chien <tzuhsiang.chien@gmail.com>2013-07-02 12:43:27 +0000
commit0a39e264330c5f6eb9e5e9e60d276613985e178d (patch)
tree391a9b207e34dc8e6a1aca645c536bba3f21a27b /lib/Target/ARM
parente5cb25f860bb4ffe6908004e6a04c8d21b7d2a98 (diff)
downloadexternal_llvm-0a39e264330c5f6eb9e5e9e60d276613985e178d.zip
external_llvm-0a39e264330c5f6eb9e5e9e60d276613985e178d.tar.gz
external_llvm-0a39e264330c5f6eb9e5e9e60d276613985e178d.tar.bz2
Fix ARM EHABI compact model 1 and 2 without handlerdata.
According to ARM EHABI section 9.2, if the __aeabi_unwind_cpp_pr1() or __aeabi_unwind_cpp_pr2() is used, then the handler data must be emitted after the unwind opcodes. The handler data consists of several words, and should be terminated by zero. In case that the .handlerdata directive is not specified by the programmer, we should emit zero to terminate the handler data. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM')
-rw-r--r--lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index dc3d945..e8b6a5a 100644
--- a/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -204,7 +204,7 @@ private:
void EmitPersonalityFixup(StringRef Name);
void FlushPendingOffset();
- void FlushUnwindOpcodes(bool AllowCompactModel0);
+ void FlushUnwindOpcodes(bool NoHandlerData);
void SwitchToEHSection(const char *Prefix, unsigned Type, unsigned Flags,
SectionKind Kind, const MCSymbol &Fn);
@@ -377,7 +377,7 @@ void ARMELFStreamer::FlushPendingOffset() {
}
}
-void ARMELFStreamer::FlushUnwindOpcodes(bool AllowCompactModel0) {
+void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
// Emit the unwind opcode to restore $sp.
if (UsedFP) {
const MCRegisterInfo *MRI = getContext().getRegisterInfo();
@@ -394,7 +394,7 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool AllowCompactModel0) {
// For compact model 0, we have to emit the unwind opcodes in the .ARM.exidx
// section. Thus, we don't have to create an entry in the .ARM.extab
// section.
- if (AllowCompactModel0 && PersonalityIndex == AEABI_UNWIND_CPP_PR0)
+ if (NoHandlerData && PersonalityIndex == AEABI_UNWIND_CPP_PR0)
return;
// Switch to .ARM.extab section.
@@ -418,6 +418,16 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool AllowCompactModel0) {
// Emit unwind opcodes
EmitBytes(StringRef(reinterpret_cast<const char *>(Opcodes.data()),
Opcodes.size()), 0);
+
+ // According to ARM EHABI section 9.2, if the __aeabi_unwind_cpp_pr1() or
+ // __aeabi_unwind_cpp_pr2() is used, then the handler data must be emitted
+ // after the unwind opcodes. The handler data consists of several 32-bit
+ // words, and should be terminated by zero.
+ //
+ // In case that the .handlerdata directive is not specified by the
+ // programmer, we should emit zero to terminate the handler data.
+ if (NoHandlerData && !Personality)
+ EmitIntValue(0, 4);
}
void ARMELFStreamer::EmitHandlerData() {