[PATCH] D27654: Stop intercepting mallinfo and mallopt on FreeBSD
Joerg Sonnenberger via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 8 10:07:29 PST 2017
joerg 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:
> > > 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.
================
Comment at: test/asan/TestCases/mallinfo-mallopt.cpp:7
+int mallinfo();
+int mallopt();
+
----------------
dim wrote:
> joerg wrote:
> > Can you make those proper protypes?
> This is not what autoconf is doing, which was the original inspiration for this change. Autoconf always uses function declarations without any parameters, and I was mimicking what they are doing.
Yeah, but that part is one of the design flaws in autoconf. I guess the problem is that declaring mallinfo correctly would need the content of the struct, so that's kind of not possible in a good way without depending on the header.
https://reviews.llvm.org/D27654
More information about the llvm-commits
mailing list