[cfe-commits] [patch] UBSAN darwin support

Jean-Daniel Dupas devlists at shadowlab.org
Tue Oct 16 13:24:52 PDT 2012


As discussed in an previous thread on cfe-dev, darwin lacks ubsan support, and so compilation with -fcatch-undefined-behavior will result in a linker error.

Here are two patches for compiler-rt to start to fix this issue.

The first one update the stub darwin SDK in compiler-rt to make it c++ safe. This is required to be able to compile ubsan using it, as ubsan is C++.
It simply adds __cplusplus guard to the headers, and rename restrict to __restrict.
This patch also add some missing declarations needed by ubsan (fputc in stdio.h and unistd.h)

The second one is an attempt to add USBAN to the Makefile build system. It also relaxes the restriction in ubsan header to allow compilation on Apple platform.

With these patches, "make clang_darwin" in compiler-rt will build an universal version of ubsan for OS X.

-- Jean-Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sdk.patch
Type: application/octet-stream
Size: 3479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121016/efe9d49b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: darwin-ubsan.patch
Type: application/octet-stream
Size: 3258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121016/efe9d49b/attachment-0001.obj>

More information about the cfe-commits mailing list