Patchwork Avoid stack protection when building libgcc

login
register
mail settings
Submitter Chung-Lin Tang
Date Sept. 3, 2010, 8:55 a.m.
Message ID <4C80B7E8.5090600@codesourcery.com>
Download mbox | patch
Permalink /patch/63596/
State New
Headers show

Comments

Chung-Lin Tang - Sept. 3, 2010, 8:55 a.m.
Hi,
this patch adds explicit avoiding of stack protection in libgcc build 
options. Many Linux distros enable -fstack-protector by default, 
building libgcc with it, and causing a link dependency on libssp that's 
sometimes inconvenient.

For a scenario, please see here:
http://lists.linaro.org/pipermail/linaro-toolchain/2010-August/000144.html

Ok, for trunk?

Thanks,
Chung-Lin
Chung-Lin Tang - Sept. 3, 2010, 8:57 a.m.
> Hi,
> this patch adds explicit avoiding of stack protection in libgcc build 
> options. Many Linux distros enable -fstack-protector by default, 
> building libgcc with it, and causing a link dependency on libssp 
> that's sometimes inconvenient.
>
> For a scenario, please see here:
> http://lists.linaro.org/pipermail/linaro-toolchain/2010-August/000144.html 
>
>
> Ok, for trunk?
>
> Thanks,
> Chung-Lin
And a ChangeLog entry:
2010-09-03  Chung-Lin Tang <cltang@codesourcery.com>

         * Makefile.in (LIBGCC2_CFLAGS): Add -fno-stack-protector, to
         explicitly disable stack protection when building libgcc.
         (CRTSTUFF_CFLAGS): Same, for crtbegin/end.
Chung-Lin Tang - Oct. 15, 2010, 3:12 a.m.
Ping.

Chung-Lin Tang wrote:
>
>> Hi,
>> this patch adds explicit avoiding of stack protection in libgcc build
>> options. Many Linux distros enable -fstack-protector by default,
>> building libgcc with it, and causing a link dependency on libssp
>> that's sometimes inconvenient.
>>
>> For a scenario, please see here:
>> http://lists.linaro.org/pipermail/linaro-toolchain/2010-August/000144.html
>>
>>
>> Ok, for trunk?
>>
>> Thanks,
>> Chung-Lin
> And a ChangeLog entry:
> 2010-09-03 Chung-Lin Tang <cltang@codesourcery.com>
>
> * Makefile.in (LIBGCC2_CFLAGS): Add -fno-stack-protector, to
> explicitly disable stack protection when building libgcc.
> (CRTSTUFF_CFLAGS): Same, for crtbegin/end.
>
Paolo Bonzini - Oct. 15, 2010, 7:53 a.m.
On 10/15/2010 05:12 AM, Chung-Lin Tang wrote:
>> http://lists.linaro.org/pipermail/linaro-toolchain/2010-August/000144.html
>>
>> 2010-09-03 Chung-Lin Tang <cltang@codesourcery.com>
>>
>> * Makefile.in (LIBGCC2_CFLAGS): Add -fno-stack-protector, to
>> explicitly disable stack protection when building libgcc.
>> (CRTSTUFF_CFLAGS): Same, for crtbegin/end.

Looks ok, but please leave until Monday for some others to notice this 
patch (CCed) and comment.

Paolo

Patch

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 163797)
+++ Makefile.in	(working copy)
@@ -650,6 +650,7 @@ 
 LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
 		 $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \
 		 -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
+		 -fno-stack-protector \
 		 $(INHIBIT_LIBC_CFLAGS)
 
 # Additional options to use when compiling libgcc2.a.
@@ -663,6 +664,7 @@ 
 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
   -finhibit-size-directive -fno-inline -fno-exceptions \
   -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
+  -fno-stack-protector \
   $(INHIBIT_LIBC_CFLAGS)
 
 # Additional sources to handle exceptions; overridden by targets as needed.