This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Split functions with exceptions in shared objects and PIEs
ClosedPublic

Authored by maksfb on Jun 15 2022, 9:53 PM.

Details

Summary

Add functionality to allow splitting code with C++ exceptions in shared
libraries and PIEs. To overcome a limitation in exception ranges format,
for functions with fragments spanning multiple sections, add trampoline
landing pads in the same section as the corresponding throwing range.

Diff Detail

Event Timeline

maksfb created this revision.Jun 15 2022, 9:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2022, 9:53 PM
maksfb requested review of this revision.Jun 15 2022, 9:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2022, 9:53 PM
Amir added a comment.Jun 15 2022, 11:05 PM

Did you see these errors from the new test?

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /tmp/lit-tmp-pe4hpdy9/exceptions_split-6209af.o
>>> referenced by exceptions_split.cpp
>>>               /tmp/lit-tmp-pe4hpdy9/exceptions_split-6209af.o:(main)

https://buildkite.com/llvm-project/premerge-checks/builds/98179#01816afe-daa6-4e44-a7c8-efb4b5b9f1f6/485-3642

Did you see these errors from the new test?

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /tmp/lit-tmp-pe4hpdy9/exceptions_split-6209af.o
>>> referenced by exceptions_split.cpp
>>>               /tmp/lit-tmp-pe4hpdy9/exceptions_split-6209af.o:(main)

https://buildkite.com/llvm-project/premerge-checks/builds/98179#01816afe-daa6-4e44-a7c8-efb4b5b9f1f6/485-3642

Not locally.

maksfb updated this revision to Diff 437653.Jun 16 2022, 11:50 AM

Add -fPIC to the test.

Amir accepted this revision.Jun 16 2022, 1:24 PM

LGTM

This revision is now accepted and ready to land.Jun 16 2022, 1:24 PM