gcc/libsanitizer/interception
YunQiang Su 557dbbac8e Sanitizer/MIPS: Use $t9 for preemptible function call
Currently, almost all of the shared libraries of MIPS, rely on $t9
to get the address of current function, instead of PCREL instructions,
even on MIPSr6. So we have to set $t9 properly.

To get the address of preemptible function, we need the help of GOT.
MIPS/O32 has .cpload, which can help to generate 3 instructions to get GOT.
For __mips64, we can get GOT by:

lui $t8, %hi(%neg(%gp_rel(SANITIZER_STRINGIFY(TRAMPOLINE(func)))))
daddu $t8, $t8, $t9
daddiu $t8, $t8, %hi(%neg(%gp_rel(SANITIZER_STRINGIFY(TRAMPOLINE(func)))))

And then get the address of __interceptor_func, and jump to it

ld $t9, %got_disp(_interceptor" SANITIZER_STRINGIFY(func) ")($t8)
jr $t9

Upstream-Commit: 0a64367a72f1634321f5051221f05f2f364bd882

libsanitizer

	* interception/interception.h (substitution_##func_name):
	Use macro C_ASM_TAIL_CALL.
	* sanitizer_common/sanitizer_asm.h: Define C_ASM_TAIL_CALL
	for MIPS with help of t9.
2024-01-17 17:03:08 +08:00
..
interception_linux.cpp libsanitizer: merge from upstream (c425db2eb558c263) 2023-11-15 12:45:58 +01:00
interception_linux.h libsanitizer: merge from upstream (c425db2eb558c263) 2023-11-15 12:45:58 +01:00
interception_mac.cpp libsanitizer: merge from master (84a71d5259c2682403cdbd8710592410a2f128ab) 2022-08-30 12:53:50 +02:00
interception_mac.h libsanitizer: merge from master (84a71d5259c2682403cdbd8710592410a2f128ab) 2022-08-30 12:53:50 +02:00
interception_type_test.cpp libsanitizer: merge from upstream (3185e47b5a8444e9fd). 2023-04-26 15:51:56 +02:00
interception_win.cpp libsanitizer: merge from upstream (c425db2eb558c263) 2023-11-15 12:45:58 +01:00
interception_win.h libsanitizer: merge from upstream (c425db2eb558c263) 2023-11-15 12:45:58 +01:00
interception.h Sanitizer/MIPS: Use $t9 for preemptible function call 2024-01-17 17:03:08 +08:00
Makefile.am libsanitizer: Add AM_CCASFLAGS to Makefile.am 2021-10-08 06:17:01 -07:00
Makefile.in libsanitizer: Check assembler support for symbol assignment [PR112563] 2023-11-28 14:54:34 +01:00