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] | |
On Tuesday 12 June 2012 13:13:19 Roland McGrath wrote:
> > * We change glibc to use _FORTIFY_SOURCE_IF_OPT?
>
> As it's not something we'd encourage users to use directly themselves,
> I think we should give it a more obscure name.
>
> But it now occurs to me that distributions might just be able to use:
>
> '-D_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 1) ? 2 : 0)'
mmm, i don't think that can work, can it ? it'll expand _FORTIFY_SOURCE into
literally "((defined __OPTIMIZE__ && __OPTIMIZE__ > 1) ? 2 : 0)" since the
preprocessor isn't recursive.
> So let's have Mike or someone similarly interested try that out. If it
> works, then we can just advise package-builders to use that (e.g. on the
> wiki somewhere) and we won't need to do anything at all in libc. Not that
> we'd advise people to break their gcc this way, but if they are going to
> predefine _FORTIFY_SOURCE, that's the thing to predefine it to. This has
> the advantage that it works with all libc versions, not just a forthcoming
> one.
doesn't seem to work as a builtin at least:
builtin_define_with_value ("_FORTIFY_SOURCE",
"((defined __OPTIMIZE__ && __OPTIMIZE__ > 1) ? 2 : 0)",
0);
$ echo _FORTIFY_SOURCE | gcc -E -
((defined __OPTIMIZE__ && __OPTIMIZE__ > 1) ? 2 : 0)
$ printf '#if _FORTIFY_SOURCE\n#else\n#error\n#endif\n' > test.c
$ gcc -c test.c
test.c:3:2: error: #error
$ gcc -c test.c -O1
test.c:3:2: error: #error
$ gcc -c test.c -O2
test.c:3:2: error: #error
$ gcc -c test.c -O3
test.c:3:2: error: #error
-mike
Attachment:
signature.asc
Description: This is a digitally signed message part.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |