[llvm-commits] [llvm-gcc-4.2] r59021 - in /llvm-gcc-4.2/trunk/gcc: common.opt config/darwin.c
Evan Cheng
evan.cheng at apple.com
Tue Nov 11 09:00:23 PST 2008
Hi Bill,
On Nov 10, 2008, at 8:28 PM, Bill Wendling wrote:
> Author: void
> Date: Mon Nov 10 22:28:21 2008
> New Revision: 59021
>
> URL: http://llvm.org/viewvc/llvm-project?rev=59021&view=rev
> Log:
> - Enable stack protectors by default for Darwin 10.6 and later.
> - Don't enable stack protectors by default for Darwin 10.5.
>
> This isn't exact. If we're building a 10.5 binary on a 10.6 system,
> then stack
> protectors should be enabled.
>
> Modified:
> llvm-gcc-4.2/trunk/gcc/common.opt
> llvm-gcc-4.2/trunk/gcc/config/darwin.c
>
> Modified: llvm-gcc-4.2/trunk/gcc/common.opt
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/common.opt?rev=59021&r1=59020&r2=59021&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/common.opt (original)
> +++ llvm-gcc-4.2/trunk/gcc/common.opt Mon Nov 10 22:28:21 2008
> @@ -1018,9 +1018,8 @@
> -fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>
>
> ; APPLE LOCAL begin stack-protector default 5095227
> -; LLVM LOCAL FIXME Don't add Init just yet
> fstack-protector
> -Common Report Var(flag_stack_protect, 1)
> +Common Report Var(flag_stack_protect, 1) Init(-1)
> Use propolice as a stack protection method
> ; APPLE LOCAL end stack-protector default 5095227
>
>
> Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=59021&r1=59020&r2=59021&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Mon Nov 10 22:28:21 2008
> @@ -2686,12 +2686,22 @@
> /* APPLE LOCAL begin stack-protector default 5095227 */
> /* Default flag_stack_protect to 1 if on 10.5 or later for user
> code,
> or 10.6 or later for code identified as part of the kernel. */
> + /* LLVM LOCAL begin - Don't enable stack protectors by default
> for Leopard. */
> +#ifndef ENABLE_LLVM
The logic here should be the same for gcc and llvm-gcc. It seems like
gcc turns it on for 10.5 but when I tried gcc-4.2 it doesn't seem to
generate stack protector code. Is darwin_macosx_version_min set by
default? If not, then flag_stack_protect is set somewhere else, right?
>
> if (flag_stack_protect == -1
> && darwin_macosx_version_min
> && ((! flag_mkernel && ! flag_apple_kext
> && strverscmp (darwin_macosx_version_min, "10.5") >= 0)
> || strverscmp (darwin_macosx_version_min, "10.6") >= 0))
> flag_stack_protect = 1;
> +#else
> + if (flag_stack_protect == -1 && darwin_macosx_version_min)
Need { } around the if else otherwise it generates a gcc compile
warning which breaks Apple style build.
Evan
>
> + if (strverscmp (darwin_macosx_version_min, "10.5") >= 0)
>
> + flag_stack_protect = 0;
> + else if (strverscmp (darwin_macosx_version_min, "10.6") >= 0)
> + flag_stack_protect = 1;
> +#endif
>
> + /* LLVM LOCAL end - Don't enable stack protectors by default for
> Leopard. */
> /* APPLE LOCAL end stack-protector default 5095227 */
> /* APPLE LOCAL diff confuses me */
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list