Just pinging this again since I've only received one test report so
far, and this really needs more testing on architectures other than
just amd64.  alpha and hppa don't have -fstack-protector, so really
that means arm, i386, mips, powerpc, sh, and sparc64.  Please please
please test if you have one of these machines!

Making sure this works is an important step towards enabling
-fstack-protector-all.  It also makes -fstack-protector emit slightly
smaller, slightly faster, and slightly more secure code for shared
libraries, all of which are nice perks.


On Wed, Aug 29, 2012 at 11:16:16AM -0700, Matthew Dempsky wrote:
> First, make sure you're using a reasonably up to date snapshot.
> You're up to date if "nm /usr/lib/crtbegin.o" mentions __guard_local.
> 
> Next, apply the patch below to GCC, recompile, and install:
> 
>   $ cd /usr/src/gnu/gcc/gcc
>   $ patch < /path/to/diff
>   $ cd /usr/src/gnu/usr.bin/cc
>   $ make depend && make && make install
> 
> Finally, test that stuff still works after you build it. :) In
> particular, make sure that you can still do a full "make build" by
> following release(8).
> 
> Please email me back with test reports.  I'm interested in getting a
> variety of (ELF) architectures before committing this.
> 
> Thanks!
> 
> 
> Index: targhooks.c
> ===================================================================
> RCS file: /cvs/src/gnu/gcc/gcc/targhooks.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 targhooks.c
> --- targhooks.c       9 May 2010 11:48:50 -0000       1.2
> +++ targhooks.c       29 Aug 2012 18:05:48 -0000
> @@ -372,7 +372,7 @@ default_stack_protect_guard (void)
>  
>    if (t == NULL)
>      {
> -      t = build_decl (VAR_DECL, get_identifier ("__guard"), ptr_type_node);
> +      t = build_decl (VAR_DECL, get_identifier ("__guard_local"), 
> ptr_type_node);
>        TREE_STATIC (t) = 1;
>        TREE_PUBLIC (t) = 1;
>        DECL_EXTERNAL (t) = 1;
> @@ -380,6 +380,8 @@ default_stack_protect_guard (void)
>        TREE_THIS_VOLATILE (t) = 1;
>        DECL_ARTIFICIAL (t) = 1;
>        DECL_IGNORED_P (t) = 1;
> +      DECL_VISIBILITY (t) = VISIBILITY_HIDDEN;
> +      DECL_VISIBILITY_SPECIFIED (t) = 1;
>  
>        stack_chk_guard_decl = t;
>      }

Reply via email to