This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix position-independent TType encoding
ClosedPublic

Authored by hvdijk on May 9 2021, 7:02 AM.

Details

Summary

The logic for x86_64 position-independent TType encodings was backwards, using 8 bytes where 4 were wanted and 4 where 8 were wanted. For regular x86_64, this was mostly harmless, exception tables are allowed to use 8-byte encodings even when it is not needed. For the large code model, and for X32, however, the generated exception tables were wrong. For the large code model, we cannot assume that the offset will fit in 4 bytes. For X32, we cannot use 64-bit relocations.

Fixes PR50148.

Diff Detail

Event Timeline

hvdijk created this revision.May 9 2021, 7:02 AM
hvdijk requested review of this revision.May 9 2021, 7:02 AM
RKSimon added a subscriber: RKSimon.
RKSimon added inline comments.
llvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll
6

Add gnux32 specific triple tests?

hvdijk updated this revision to Diff 343913.May 9 2021, 8:54 AM
hvdijk edited the summary of this revision. (Show Details)

Added gnux32 to test.

hvdijk marked an inline comment as done.May 9 2021, 8:56 AM
hvdijk added inline comments.
llvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll
6

I was hoping to avoid it because the --check-prefixes are getting quite long and the change was already being tested without it, but alright, done.

RKSimon accepted this revision.May 10 2021, 4:17 AM

LGTM

This revision is now accepted and ready to land.May 10 2021, 4:17 AM
This revision was landed with ongoing or failed builds.May 10 2021, 9:05 AM
This revision was automatically updated to reflect the committed changes.

Thanks for fixing this:)