aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-12-19 12:10:06 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-12-19 12:10:07 +0000
commita3ebbc54575b8a9ca280cb3587bb90bddd34352c (patch)
treedc2f004a3158bc64f7ee276ff4f2d4757d06497c
parent7ca84cb41682bcc3b654be7a82cb59c5a47ad046 (diff)
parent474aa36a84295a481c749514f3d30e0e11f7df87 (diff)
downloadllvm-release_35.tar.gz
Merge "[3.5] writable .gcc_except_table for mips[64]" into release_35release_35
-rw-r--r--lib/MC/MCObjectFileInfo.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/MC/MCObjectFileInfo.cpp b/lib/MC/MCObjectFileInfo.cpp
index aeb92991b3d..d0e6990e93b 100644
--- a/lib/MC/MCObjectFileInfo.cpp
+++ b/lib/MC/MCObjectFileInfo.cpp
@@ -265,6 +265,8 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
}
void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
+ bool writable_gcc_except_table = false;
+
switch (T.getArch()) {
case Triple::mips:
case Triple::mipsel:
@@ -346,6 +348,29 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
// eh_frame section can be read-only. DW.ref.personality will be generated
// for relocation.
PersonalityEncoding = dwarf::DW_EH_PE_indirect;
+ if (TT.getEnvironment() == llvm::Triple::Android) {
+ // To match GCC/mips behavior in gcc/except.c as below, to avoid
+ // .../ld: warning: creating a DT_TEXTREL in a shared object.
+ //
+ // switch_to_exception_section (const char * ARG_UNUSED (fnname))
+ // {
+ // ....
+ // if (EH_TABLES_CAN_BE_READ_ONLY)
+ // {
+ // int tt_format =
+ // ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1); # DW_EH_PE_indirect which is 0x80
+ // flags = ((! flag_pic
+ // || ((tt_format & 0x70) != DW_EH_PE_absptr/*0x00*/
+ // && (tt_format & 0x70) != DW_EH_PE_aligned/*0x50*/))
+ // ? 0 : SECTION_WRITE);
+ // }
+ // else
+ // flags = SECTION_WRITE;
+ //
+ // FIXME: Check PIC (default in Android, though)
+ //
+ writable_gcc_except_table = true;
+ }
break;
case Triple::ppc64:
case Triple::ppc64le:
@@ -498,7 +523,7 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
// adjusted or this should be a data section.
LSDASection =
Ctx->getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
- ELF::SHF_ALLOC,
+ ELF::SHF_ALLOC | (writable_gcc_except_table? ELF::SHF_WRITE : 0),
SectionKind::getReadOnly());
COFFDebugSymbolsSection = nullptr;