This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using __chk_fail from libstdc++


> I need to call it from template code.  I could conceivably add a wrapper 
> which falls back to abort if __chk_fail is not available, but I'm 
> working on a libc-only feature anyway (_FORTIFY_SOURCE for some C++ 
> constructs).  Thus my preference is to avoid the wrapper.

I don't think it's an issue that __chk_fail might not be available.
It's in the 2.3.4 version set, so that's only an issue if libstdc++
doesn't already require a libc at least that new.

I was just talking about including a libc-provided header file to declare
it.  Since we don't have one now, that would be a new header file name
only available on libc 2.16 or later (or 2.17 if we don't get it in soon).
If you use other libc headers already, I guess you could just use:
	#if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 16
	# include <bits/fortify.h>
	#else
	extern "C" void __chk_fail () __attribute__((noreturn));
	#endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]