================
@@ -2831,8 +2837,26 @@ GlobalVariable
*ModuleAddressSanitizer::getOrCreateModuleName() {
if (!ModuleName) {
// We shouldn't merge same module names, as this string serves as unique
// module ID in runtime.
+ std::string ModuleNameStr = M.getModuleIdentifier();
+
+ // If a compilation dir is set, make absolute paths relative to it.
+ if (!CompilationDir.empty()) {
+ SmallString<256> Path(ModuleNameStr);
+ if (sys::path::is_absolute(Path)) {
+ SmallString<256> CompDir(CompilationDir);
+ if (!sys::path::is_absolute(CompDir))
+ sys::fs::make_absolute(CompDir);
+ sys::path::remove_dots(CompDir, /*remove_dot_dot=*/true);
+ // Ensure trailing separator so "/foo" doesn't match "/foobar/x.c".
+ if (!CompDir.empty() && !sys::path::is_separator(CompDir.back()))
+ CompDir += sys::path::get_separator();
----------------
vitalybuka wrote:
Why M.getModuleIdentifier() is not already fixed by fsanitize_compilation_dir
in the clang?
If so, we need no special sanitizer specific processing?
https://github.com/llvm/llvm-project/pull/201803
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits