Android MIPS executable loader prohibits the relocation
in the read-only section. Thus, we have to use
DW_EH_PE_indirect instead.
Details
Diff Detail
Event Timeline
My background is in C and Embedded-C compilers so my knowledge of things like CFI is rather limited at the moment and I don't think I'm suitable to review this patch. Hopefully someone who knows this area better will also take a look.
Bearing that in mind, a couple things look a bit odd to me. I've put the comments inline.
lib/MC/MCObjectFileInfo.cpp | ||
---|---|---|
328 | I'm fairly sure that the if-statement should be testing for RelocM == Reloc::PIC_ rather than Android. I'm not so sure what the correct PersonalityEncoding is but DW_EH_PE_indirect by itself seems odd. I see that all the other targets are combining DW_EH_PE_indirect with DW_EH_PE_pcrel and one of the data size values. If this is the right thing to do for MIPS then it removes the need for the change to getCFIPersonalitySymbol(). However, it's possible that it should be combining DW_EH_PE_indirect with DW_EH_PE_absptr. |
The problem here is that MIPS doesn't allow PC-relative relocations against a symbol in a different section. That said, I believe indirect encoding should be used for MIPS in the PIC case in general. I'm not sure about the correctness of the rest of the patch yet.
The indirect pointer change should not limit to Android.
After checking the output of GCC on Debian mipsel port,
it seems that this change should be applied regardless the -fPIC
flags.
Besides, Joerg's comment is correct. It seems that
MIPS doesn't allow PC-relative relocations between sections, thus
we should use DW_EH_PE_absptr instead of PW_EH_PE_pcrel.
p.s. DW_EH_PE_absptr = 0
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp | ||
---|---|---|
63 | Don't we just want to check DW_EH_PE_indirect here? Non-indirect references would have already been in place. | |
lib/CodeGen/TargetLoweringObjectFileImpl.cpp | ||
52 | Same here. | |
lib/MC/MCObjectFileInfo.cpp | ||
327 | Just plain DW_EH_PE_indirect, I think. The absptr is implicit. |
Don't we just want to check DW_EH_PE_indirect here? Non-indirect references would have already been in place.