[Bug 256524] Does FreeBSD 12.2-RELEASE amd64 support -fsanitize=leak?

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 10 Jun 2021 06:23:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256524

            Bug ID: 256524
           Summary: Does FreeBSD 12.2-RELEASE amd64 support
                    -fsanitize=leak?
           Product: Base System
           Version: 12.2-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: ota@j.email.ne.jp

Looking at
/usr/src/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp, amd64
seems to support while i386 does not for clang10, on 12.2-RELEASE:

  SanitizerMask Res = ToolChain::getSupportedSanitizers();
  Res |= SanitizerKind::Address;
  Res |= SanitizerKind::PointerCompare;
  Res |= SanitizerKind::PointerSubtract;
  Res |= SanitizerKind::Vptr;
  if (IsX86_64 || IsMIPS64) {
    Res |= SanitizerKind::Leak;
    Res |= SanitizerKind::Thread;
  }
  if (IsX86 || IsX86_64) {
    Res |= SanitizerKind::Function;
    Res |= SanitizerKind::SafeStack;   
    Res |= SanitizerKind::Fuzzer;
    Res |= SanitizerKind::FuzzerNoLink;
  }

However, amd64 mach gives me "No such file" error while linking.
amd64% clang++ -fsanitize=leak address_sanitizer.cpp
ld: error: cannot open
/usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.lsan-x86_64
.a: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see
invocation
)

i386 explicitly says it is not supported.
i386% clang++ -fsanitize=leak address_sanitizer.cpp
clang++: error: unsupported option '-fsanitize=leak' for target
'i386-unknown-freebsd13.0'

Given Clang 13 document, https://clang.llvm.org/docs/LeakSanitizer.html,
doesn't say FreeBSD is supported, I'm not sure if amd64 case is unsupported or
an error.
I only have 12.2 RELEASE for amd64 and cannot experiment other FreeBSD version.

% cat address_sanitizer.cpp
int main()
{
    int *i = new int( 1 );
    *i = 0;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.