[compiler-rt] [sanitizer-common] [Darwin] Fix overlapping dyld segment addresses (PR #166005)

Dan Blackwell via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 04:06:28 PST 2025


================
@@ -0,0 +1,20 @@
+// This test simply checks that the "Invalid dyld module map" warning is not printed
----------------
DanBlackwell wrote:

I think we could make this test a little stronger to try and catch breaking changes earlier:

```
// This test simply checks that the "Invalid dyld module map" warning is not printed
// in the output of a backtrace.

// RUN: %clangxx_asan -DSHARED_LIB -g %s -dynamiclib -o %t.dylib
// RUN: %clangxx_asan -O0 -g %s %t.dylib -o %t.executable
// RUN: %env_asan_opts="print_module_map=2" not %run %t.executable 2>&1 | FileCheck %s -DDYLIB=%t.dylib

// CHECK-DAG: 0x{{.*}}-0x{{.*}} [[DYLIB]]
// CHECK-DAG: 0x{{.*}}-0x{{.*}} {{.*}}libsystem
// CHECK-NOT: WARN: Invalid dyld module map

#ifdef SHARED_LIB
extern "C" void foo(int *a) { *a = 5; }
#else
#include <cstdlib>

extern "C" void foo(int *a);

int main() {
  int *a = (int *)malloc(sizeof(int));
  free(a);
  foo(a);
  return 0;
}
#endif
```

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


More information about the llvm-commits mailing list