================
@@ -1046,36 +1046,18 @@ def is_compiler_clang_with_ubsan():
outputf,
):
return "Compiler cannot compile with -fsanitize=undefined"
+ if not outputf.path:
+ return "Cannot create Temp file path."
+
+ nm_bin = configuration.get_nm_path()
+ if not nm_bin:
+ return "No llvm-nm or nm binary."
# Check that we actually see ubsan instrumentation in the binary.
- cmd = "nm %s" % outputf.path
- with os.popen(cmd) as nm_output:
- if "___ubsan_handle_divrem_overflow" not in nm_output.read():
- return "Division by zero instrumentation is missing"
-
- # Find the ubsan dylib.
- # FIXME: This check should go away once compiler-rt gains support for
__ubsan_on_report.
- cmd = (
- "%s -fsanitize=undefined -x c - -o - -### 2>&1"
- % lldbplatformutil.getCompiler()
- )
- with os.popen(cmd) as cc_output:
- driver_jobs = cc_output.read()
- m = re.search(r'"([^"]+libclang_rt.ubsan_osx_dynamic.dylib)"',
driver_jobs)
- if not m:
- return "Could not find the ubsan dylib used by the driver"
- ubsan_dylib = m.group(1)
-
- # Check that the ubsan dylib has special monitor hooks.
- cmd = "nm -gU %s" % ubsan_dylib
- with os.popen(cmd) as nm_output:
- syms = nm_output.read()
- if "___ubsan_on_report" not in syms:
- return "Missing ___ubsan_on_report"
- if "___ubsan_get_current_report_data" not in syms:
- return "Missing ___ubsan_get_current_report_data"
-
- # OK, this dylib + compiler works for us.
+ nm_output = subprocess.check_output([nm_bin, outputf.path],
text=True)
+ if "__ubsan_handle_divrem_overflow" not in nm_output:
+ return "Division by zero instrumentation is missing"
----------------
adrian-prantl wrote:
why is the check in `libclang_rt.ubsan_osx_dynamic.dylib` no longer needed?
https://github.com/llvm/llvm-project/pull/177964
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits