[Xapian-devel] -D_FORTIFY_SOURCE (was Re: [Xapian-commits] 7903:
trunk/xapian-core/)
Richard Boulton
richard at lemurconsulting.com
Wed Mar 7 21:27:53 GMT 2007
Olly Betts wrote:
> It's hardly documented *well* in features.h either, at least in the
> version I have (glibc "2.4-1ubuntu12.3")!
Nor in mine - that was badly phrased: should have been something like
"not documented well; a small amount of documentation is in features.h".
> Sad really, it sounds like a
> promising idea, but if it's not advertised people just won't know to use
> it.
For the record, I came across it when reading this:
https://ols2006.108.redhat.com/reprints/jones-reprint.pdf
> There's perhaps a reason for that - the vast majority of the tests
> for __USE_FORTIFY_SOURCE (which is what _FORTIFY_SOURCE controls)
> in the glibc headers are followed by "&& !defined __cplusplus"!
Bah! Well, I did manage to get an error out of it by breaking some of
the code in flint, so it's not completely useless; hopefully C++ support
will get better with time.
> It also doesn't activate at all unless you're using GCC >= 4.1
> so if your GCC is older, it'll have no effect at all on speed or
> fortification.
Ah, I couldn't find documentation on which GCC you needed for it, but I
assumed it was fairly recent.
> The only thing which seems to actually be activated for C++ is some
> stuff to do with "__builtin_object_size", which seems to allow
> checking of the size of buffers known at compile time. We don't make
> much use of static sized buffers, and we use snprintf where available,
> but it doesn't hurt to have extra checks if the overhead is small.
>
> I prodded glibc CVS and found the vanilla glibc version this was first
> in, though it looks like RH backported this to older GCC (and possibly
> older glibc) for their distros. I'll add that to the comment.
Cool.
--
Richard
More information about the Xapian-devel
mailing list