@@ -363,7 +363,7 @@ class HWAddressSanitizer {
363
363
Value *getAllocaTag (IRBuilder<> &IRB, Value *StackTag, unsigned AllocaNo);
364
364
Value *getUARTag (IRBuilder<> &IRB);
365
365
366
- Value *getHwasanThreadSlotPtr (IRBuilder<> &IRB, Type *Ty );
366
+ Value *getHwasanThreadSlotPtr (IRBuilder<> &IRB);
367
367
Value *applyTagMask (IRBuilder<> &IRB, Value *OldTag);
368
368
unsigned retagMask (unsigned AllocaNo);
369
369
@@ -1219,20 +1219,10 @@ Value *HWAddressSanitizer::untagPointer(IRBuilder<> &IRB, Value *PtrLong) {
1219
1219
return UntaggedPtrLong;
1220
1220
}
1221
1221
1222
- Value *HWAddressSanitizer::getHwasanThreadSlotPtr (IRBuilder<> &IRB, Type *Ty) {
1223
- Module *M = IRB.GetInsertBlock ()->getParent ()->getParent ();
1224
- if (TargetTriple.isAArch64 () && TargetTriple.isAndroid ()) {
1225
- // Android provides a fixed TLS slot for sanitizers. See TLS_SLOT_SANITIZER
1226
- // in Bionic's libc/private/bionic_tls.h.
1227
- Function *ThreadPointerFunc =
1228
- Intrinsic::getDeclaration (M, Intrinsic::thread_pointer);
1229
- return IRB.CreateConstGEP1_32 (Int8Ty, IRB.CreateCall (ThreadPointerFunc),
1230
- 0x30 );
1231
- }
1232
- if (ThreadPtrGlobal)
1233
- return ThreadPtrGlobal;
1234
-
1235
- return nullptr ;
1222
+ Value *HWAddressSanitizer::getHwasanThreadSlotPtr (IRBuilder<> &IRB) {
1223
+ if (TargetTriple.isAArch64 () && TargetTriple.isAndroid ())
1224
+ return memtag::getAndroidSanitizerSlotPtr (IRB);
1225
+ return ThreadPtrGlobal;
1236
1226
}
1237
1227
1238
1228
Value *HWAddressSanitizer::getCachedFP (IRBuilder<> &IRB) {
@@ -1271,7 +1261,7 @@ void HWAddressSanitizer::emitPrologue(IRBuilder<> &IRB, bool WithFrameRecord) {
1271
1261
1272
1262
auto getThreadLongMaybeUntagged = [&]() {
1273
1263
if (!SlotPtr)
1274
- SlotPtr = getHwasanThreadSlotPtr (IRB, IntptrTy );
1264
+ SlotPtr = getHwasanThreadSlotPtr (IRB);
1275
1265
if (!ThreadLong)
1276
1266
ThreadLong = IRB.CreateLoad (IntptrTy, SlotPtr);
1277
1267
// Extract the address field from ThreadLong. Unnecessary on AArch64 with
0 commit comments