[PATCH] D27654: Stop intercepting mallinfo and mallopt on FreeBSD

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 02:27:02 PST 2017


dim added inline comments.


================
Comment at: test/asan/TestCases/mallinfo-mallopt.cpp:4
+// RUN: %clang_asan %s -o %t
+// XFAIL: freebsd
+
----------------
dim wrote:
> joerg wrote:
> > dim wrote:
> > > joerg wrote:
> > > > dim wrote:
> > > > > kcc wrote:
> > > > > > hm. is freebsd the only platform where this will fail? 
> > > > > > What about other non-linux OSes? 
> > > > > Indeed, probably better to make this test succeed on Linux only.  Is there any way to express `XFAIL: !linux` ?
> > > > My suggestion would be to do conditionalize the main function, i.e.
> > > > 
> > > > ```
> > > > #if __glibc__
> > > >   mallinfo();
> > > >   mallopt();
> > > > #else
> > > >   void non_existant_function(void);
> > > >   non_existant_function();
> > > > #endif
> > > > ```
> > > > 
> > > > and just check for linking error on all platforms.
> > > Actually, the error we're checking for is that mallinfo() and mallopt() are *not* incorrectly intercepted.  So we have to specifically attempt to link these functions in, and see if those don't cause any error, and if they don't, there is a regression.
> > Sorry, inverted condition. I meant '#if !__glibc__'. That should make it clearer. My point is to link against something explicitly undefined for glibc and just make sure that it always fails that way.
> Ah yes, I see what you mean.
Hm, though __glibc__ is only defined by including one of the glibc headers, I assume? I'll have to look it up on a Linux system.


https://reviews.llvm.org/D27654





More information about the llvm-commits mailing list