================
@@ -385,6 +385,26 @@ run-time performance, which leads to increased binary 
size. Using the
 flag forces all code instrumentation to be outlined, which reduces the size
 of the generated code, but also reduces the run-time performance.
 
+### Remapping source paths
+
+AddressSanitizer embeds the source file path in global metadata. For
+reproducible builds, the option `-fsanitize-prefix-map=OLD=NEW` can be used
+to remap these paths. If a source path starts with `OLD`, it will be replaced
+with `NEW`.
+
+#### Example
+
+```console
+# Strip build directory prefix
+$ clang -fsanitize=address -fsanitize-prefix-map=/build/dir/= source.c
+
+# Remap to a canonical path
+$ clang -fsanitize=address -fsanitize-prefix-map=/home/user/project=/src 
source.c
+```
+
+Multiple `-fsanitize-prefix-map` options can be specified; the first matching
----------------
vitalybuka wrote:

```suggestion
Multiple `-fsanitize-prefix-map` options can be specified; the last matching
```

https://github.com/llvm/llvm-project/pull/186908
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to