This is an archive of the discontinued LLVM Phabricator instance.

[mips][micromips] Fix values in .gcc_except_table for -fPIC
ClosedPublic

Authored by abeserminji on Feb 4 2019, 2:54 AM.

Details

Summary

When a landing pad is calculated in a program that is compiled
for micromips with -fPIC flag, it will point to an even address.
Such an error will cause a segmentation fault, as the instructions
in micromips are aligned on odd addresses. This patch sets the
last bit of the offset where a landing pad is, to 1, which will
effectively be an odd address and point to the instruction exactly.

Patch D52985 fixed this issue for -static compilation.

Diff Detail

Event Timeline

abeserminji created this revision.Feb 4 2019, 2:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2019, 2:54 AM
This revision is now accepted and ready to land.Feb 6 2019, 2:11 PM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.
llvm/trunk/test/CodeGen/Mips/micromips-b-range.ll
16 ↗(On Diff #185875)

Changes to this file seem wrong. I have produced an assembly file and assembled it with mipsel-linux-gnu-gcc -mmicromips. The values are even.

Apologies, but I am going to revert the MCExpr.cpp change in D157655.

Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 8:46 PM

Yes. microMIPS support needs lots of work.