[cfe-dev] Clang++ and _FORTIFY_SOURCE: Supported or not?

John Snow via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 2 16:27:30 PST 2015


Hi, all:

I'm trying to find an official notice of support (or a contrary notice)
for Clang++ and -D_FORTIFY_SOURCE=2.

The QEMU project ran into an issue recently [1] where Clang++
(3.5.0-9.fc22) failed to compile certain files because it does not have
definitions for __builtin_va_pack_len (and friends). This kicks up
errors when using glibc, cstdio and _FORTIFY_SOURCE together.

When researching the problem, we ran across an llvm bug [2] where
Richard Smith states: "_FORTIFY_SOURCE + glibc + clang is not supported
and does not work".

However, in testing Clang++ 3.7.0-1.fc23, I notice that
-D_FORTIFY_SOURCE does indeed appear to work. Is that a fluke, or do
modern versions (>3.5.0) of Clang actually support this combination?

I can't find official documentation pointing towards either support or
exclusion of this feature, so a firm answer pointing to either direction
would be helpful.

Thank you,
--John Snow

[1] QEMU discussion:
https://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg06997.html
[2] https://llvm.org/bugs/show_bug.cgi?id=23277#c2



More information about the cfe-dev mailing list