summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-02-24 23:34:35 +0000
committerBill Wendling <isanbard@gmail.com>2010-02-24 23:34:35 +0000
commit88fdcd323d89f769cd2afd19cec45318780ebe83 (patch)
tree0b47ac0df85b8c76aadb54d48279cec970229e85 /llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
parent40d732fee709d7cb28443040c0a86662111f1a41 (diff)
downloadbcm5719-llvm-88fdcd323d89f769cd2afd19cec45318780ebe83.tar.gz
bcm5719-llvm-88fdcd323d89f769cd2afd19cec45318780ebe83.zip
LLVM puts padding bytes in the __gcc_except_tab section after the
GCC_except_table label but before the Lexception, which the FDE references. This causes problems as the FDE does not point to the start of an LSDA chunk. Use an unnormalized uleb128 for the call-site table length that includes the padding. llvm-svn: 97078
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index 1299d048e4b..25337cb765b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -159,29 +159,37 @@ void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const {
Value >>= 7;
IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
if (IsMore) Byte |= 0x80;
-
Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0);
} while (IsMore);
}
/// EmitULEB128 - emit the specified signed leb128 value.
-void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc) const {
+void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc,
+ unsigned PadTo) const {
if (Asm->VerboseAsm && Desc)
Asm->OutStreamer.AddComment(Desc);
- if (MAI->hasLEB128()) {
+ if (MAI->hasLEB128() && PadTo == 0) {
O << "\t.uleb128\t" << Value;
Asm->OutStreamer.AddBlankLine();
return;
}
- // If we don't have .uleb128, emit as .bytes.
+ // If we don't have .uleb128 or we want to emit padding, emit as .bytes.
do {
unsigned char Byte = static_cast<unsigned char>(Value & 0x7f);
Value >>= 7;
- if (Value) Byte |= 0x80;
+ if (Value || PadTo != 0) Byte |= 0x80;
Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0);
} while (Value);
+
+ if (PadTo)
+ while (PadTo--) {
+ unsigned char Byte = (PadTo ? 0x80 : 0x00);
+ if (Asm->VerboseAsm)
+ Asm->OutStreamer.AddComment("Padding");
+ Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0);
+ }
}
OpenPOWER on IntegriCloud