[compiler-rt] [tsan] Allow unloading of ignored libraries (PR #105660)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 16:50:46 PDT 2024


================
@@ -54,24 +54,51 @@ class LibIgnore {
     char *name;
     char *real_name;  // target of symlink
     bool loaded;
+    uptr ignored_code_range_id;
   };
 
   struct LibCodeRange {
     uptr begin;
     uptr end;
   };
 
+  // Marks a range as loaded by utilizing the least significant bit of the code
+  // range. Assumes the start of the code range is 2-byte aligned.
+  struct LibLoadedCodeRange {
+    uptr begin() const { return begin_ << 1; }
+    void begin(uptr begin) {
+      CHECK_EQ(begin & 0x1, 0);
+      begin_ = begin >> 1;
+    }
+
+   private:
+    uptr begin_ : 63;
+
+   public:
+    uptr loaded : 1;
+    uptr end;
+  };
+
+  static_assert(sizeof(LibLoadedCodeRange) == 16,
+                "LibLoadedCodeRange size expected to be 16-bytes for "
+                "performance reasons.");
+
+  inline bool IsInRange(uptr pc, const LibLoadedCodeRange &range) const {
----------------
vitalybuka wrote:

Please make both IsInRange a members

https://github.com/llvm/llvm-project/pull/105660


More information about the llvm-commits mailing list