Adds support for xray on mips/mipsel/mips64/mips64el.
Patches for llvm and clang:
Paths
| Differential D27699
[Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el ClosedPublic Authored by slthakur on Dec 12 2016, 10:43 PM.
Details
Summary Adds support for xray on mips/mipsel/mips64/mips64el. Patches for llvm and clang:
Diff Detail
Event Timelineslthakur updated this object. Comment Actions Removed patching of instruction "addiu t9, t9, 44" as it was unnecessary since it will always be there at the end of the sled when xray instrumentation is enabled. This revision is now accepted and ready to land.Dec 14 2016, 10:19 PM slthakur retitled this revision from [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel to [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el. slthakur updated this object. slthakur edited edge metadata. Comment ActionsAdding mips64 support for xray along with this change since I have the patch ready. sdardis edited edge metadata. Comment ActionsThe sled has an issue in that it requires 64bit atomic operations to disable it. MIPS32 doesn't natively support such operations and MIPS64 would need alignment guarantees to perform a 64 bit write. Instead if we use a sled like this: addiu sp, sp, -8 ;create stack frame nop ;avoid the need for 64bit atomics. sw ra, 4(sp) ;save return address sw t9, 0(sp) ;save register t9 lui t9, <Upper half of address of TracingHook> ori t9, t9, <Lower half of address of TracingHook> jalr t9 ;call Tracing hook addiu t0 , zero, #<function ID> ;pass function id (delay slot) lw t9, 0(sp) ;restore register t9 lw ra, 4(sp) ;restore return address addiu sp, sp, 8 ;delete stack frame We can disable or re-enable the sled with a single 32 bit write by changing addiu sp, sp, -8 to b.
This revision now requires changes to proceed.Jan 11 2017, 8:39 AM slthakur edited edge metadata. slthakur marked 29 inline comments as done. Comment ActionsAddressed review comments
Comment Actions LGTM with nits addressed.
This revision is now accepted and ready to land.Jan 24 2017, 4:00 AM
Revision Contents
Diff 82210 cmake/config-ix.cmake
lib/xray/CMakeLists.txt
lib/xray/tests/CMakeLists.txt
lib/xray/xray_inmemory_log.cc
lib/xray/xray_interface.cc
lib/xray/xray_mips.cc
lib/xray/xray_mips64.cc
lib/xray/xray_trampoline_mips.S
lib/xray/xray_trampoline_mips64.S
test/xray/TestCases/Linux/pic_test.cc
|
That comment should be "LUI T9, (<Address> >> 16) & 0xffff