[compiler-rt] r202122 - Enable UBSan on FreeBSD. Patch by Viktor Kutuzov.
Roman Divacky
rdivacky at freebsd.org
Tue Feb 25 14:19:22 PST 2014
I tried to use ubsan and
1) compiler-rt doesnt compile for me, I need this patch:
Index: ../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- ../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h (revision 202195)
+++ ../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h (working copy)
@@ -378,6 +378,10 @@
// The size is determined by looking at sizeof of real sigset_t on linux.
uptr val[128 / sizeof(uptr)];
};
+#elif SANITIZER_FREEBSD
+ struct __sanitizer_sigset_t {
+ u32 val[4];
+ };
#endif
// Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
2) the clang driver doesnt add sanitizer arguments:
Index: ../tools/clang/lib/Driver/Tools.cpp
===================================================================
--- ../tools/clang/lib/Driver/Tools.cpp (revision 202180)
+++ ../tools/clang/lib/Driver/Tools.cpp (working copy)
@@ -6172,6 +6172,7 @@
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
}
+ addSanitizerRuntimes(getToolChain(), Args, CmdArgs);
addProfileRT(ToolChain, Args, CmdArgs);
const char *Exec =
3) Even with the above, it doesnt work because addSanitizerRuntimes() is not adjusted
for freebsd (ie. it looks for sanitizer libs in freebsd9.2 instead of freebsd dir and
tries to add -ldl which doesn exist on freebsd)
4) even when I correct that (manually), ubsan doesnt link with lots of undefined symbols,
eg.:
__sanitizer::StackTrace::SlowUnwindStackWithContext etc.
Can you shed some light on the status?
On Tue, Feb 25, 2014 at 08:29:36AM -0000, Alexey Samsonov wrote:
> Author: samsonov
> Date: Tue Feb 25 02:29:36 2014
> New Revision: 202122
>
> URL: http://llvm.org/viewvc/llvm-project?rev=202122&view=rev
> Log:
> Enable UBSan on FreeBSD. Patch by Viktor Kutuzov.
>
> Modified:
> compiler-rt/trunk/lib/ubsan/ubsan_value.h
>
> Modified: compiler-rt/trunk/lib/ubsan/ubsan_value.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_value.h?rev=202122&r1=202121&r2=202122&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/ubsan/ubsan_value.h (original)
> +++ compiler-rt/trunk/lib/ubsan/ubsan_value.h Tue Feb 25 02:29:36 2014
> @@ -14,9 +14,9 @@
> #ifndef UBSAN_VALUE_H
> #define UBSAN_VALUE_H
>
> -// For now, only support linux and darwin. Other platforms should be easy to
> -// add, and probably work as-is.
> -#if !defined(__linux__) && !defined(__APPLE__)
> +// For now, only support Linux, FreeBSD and Darwin. Other platforms should
> +// be easy to add, and probably work as-is.
> +#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__APPLE__)
> #error "UBSan not supported for this platform!"
> #endif
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list