This is an archive of the discontinued LLVM Phabricator instance.

[XRay][compiler-rt] Make __xray_CustomEvent PIC friendlier and build a dynamic version of the XRay runtime
AbandonedPublic

Authored by dberris on Sep 1 2017, 12:24 AM.

Details

Reviewers
pcc
bkramer
Summary

This change moves the __xray_CustomEvent trampoline implementation from
being written in X86 assembly to C++. This allows us to leverage the
toolchain's capability to define entries for the global object table
(GOT) for globals and procedure linkage table (PLT), instead of
attempting to write those routines down in assembly.

We also take the chance to build a dynamic version of the XRay library
to prepare for enabling the use of the XRay runtime as a dynamic
library. This will require a bit more changes down the line to have a
fully supported dynamic XRay library.

We'll start adding tests to make sure that we can actually use the XRay
library in a shared library in succeeding patches.

Event Timeline

dberris created this revision.Sep 1 2017, 12:24 AM
pcc edited edge metadata.Sep 1 2017, 9:19 AM

I'm not sure if this change will do what you think it does. The linker should create GOTs and PLTs for all symbols, even those defined by .s files, as long as an appropriate relocation exists. In particular the change you are making in D37373 should on its own result in the creation of PLT entries for __xray_CustomEntry. Can you please explain the problem that you are trying to solve?

dberris abandoned this revision.Oct 7 2017, 2:57 AM
dberris added a subscriber: pelikan.

Right, thanks @pcc -- abandoning now.

The dynamic library changes here might be something that @pelikan might be interested in based on some offline conversations.