* stack usage with libgcc math funcs
@ 2008-12-24 17:13 Mike Frysinger
2008-12-24 17:28 ` Mike Frysinger
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Mike Frysinger @ 2008-12-24 17:13 UTC (permalink / raw)
To: linux-sh
[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]
i dont know superh assembly, so i cant really check the code myself. starting
with at gcc-4.1.2 (at least, gcc-3.4.6 doesnt seem to have this issue), a few
objects in libgcc.a lack GNU-stack markings. here is the scanelf output
against libgcc.a from gcc-4.3.2. basically, '!WX' just means that the objects
do not have a .note.GNU-stack section.
$ scanelf -qeR .
!WX --- --- ./4.3.2/_ashiftrt.o
!WX --- --- ./4.3.2/_ashiftrt_n.o
!WX --- --- ./4.3.2/_ashiftlt.o
!WX --- --- ./4.3.2/_lshiftrt.o
!WX --- --- ./4.3.2/_movmem.o
!WX --- --- ./4.3.2/_movmem_i4.o
!WX --- --- ./4.3.2/_mulsi3.o
!WX --- --- ./4.3.2/_sdivsi3.o
!WX --- --- ./4.3.2/_sdivsi3_i4.o
!WX --- --- ./4.3.2/_udivsi3.o
!WX --- --- ./4.3.2/_udivsi3_i4.o
!WX --- --- ./4.3.2/_set_fpscr.o
!WX --- --- ./4.3.2/_div_table.o
!WX --- --- ./4.3.2/_udiv_qrnnd_16.o
!WX --- --- ./4.3.2/_ic_invalidate.o
!WX --- --- ./4.3.2/_ic_invalidate_array.o
!WX --- --- ./4.3.2/linux-atomic.o
assuming libgcc doesnt actually use the stack to exec code, the attached patch
should fix things i think.
-mike
--- gcc/config/sh/lib1funcs.asm
+++ gcc/config/sh/lib1funcs.asm
@@ -34,6 +34,11 @@
!! recoded in assembly by Toshiyasu Morita
!! tm@netcom.com
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
+
/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
ELF local label prefixes by J"orn Rennecke
amylaar@cygnus.com */
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stack usage with libgcc math funcs
2008-12-24 17:13 stack usage with libgcc math funcs Mike Frysinger
@ 2008-12-24 17:28 ` Mike Frysinger
2008-12-24 22:57 ` Kaz Kojima
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2008-12-24 17:28 UTC (permalink / raw)
To: linux-sh
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
and linux-atomic.asm needs a similar change
--- gcc/config/sh/linux-atomic.asm
+++ gcc/config/sh/linux-atomic.asm
@@ -138,3 +138,8 @@
ATOMIC_FETCH_AND_COMBOP(nand,and,not,4,l,mov)
#endif /* ! __SH5__ */
+
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
as a note, without these changes, the execstack markings bubble up into some
of the glibc libs as those are built with -static-libgcc ... i can see this
with glibc-2.9 for sure.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stack usage with libgcc math funcs
2008-12-24 17:13 stack usage with libgcc math funcs Mike Frysinger
2008-12-24 17:28 ` Mike Frysinger
@ 2008-12-24 22:57 ` Kaz Kojima
2008-12-25 0:15 ` Mike Frysinger
2008-12-25 1:22 ` Kaz Kojima
3 siblings, 0 replies; 5+ messages in thread
From: Kaz Kojima @ 2008-12-24 22:57 UTC (permalink / raw)
To: linux-sh
Mike Frysinger <vapier@gentoo.org> wrote:
> i dont know superh assembly, so i cant really check the code myself. starting
> with at gcc-4.1.2 (at least, gcc-3.4.6 doesnt seem to have this issue), a few
> objects in libgcc.a lack GNU-stack markings. here is the scanelf output
> against libgcc.a from gcc-4.3.2. basically, '!WX' just means that the objects
> do not have a .note.GNU-stack section.
> assuming libgcc doesnt actually use the stack to exec code, the attached patch
> should fix things i think.
Thanks for pointing this out. Could you please send your
patches to gcc-patches or file this issue to gcc bugzilla?
Unfortunately, now gcc trunk is in stage 4 and any patches
for non strict regressions can't be accepted temporary.
I'll schedule these patches for 4.5, then apply them to
the open branches after 4.5.
Thanks,
kaz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stack usage with libgcc math funcs
2008-12-24 17:13 stack usage with libgcc math funcs Mike Frysinger
2008-12-24 17:28 ` Mike Frysinger
2008-12-24 22:57 ` Kaz Kojima
@ 2008-12-25 0:15 ` Mike Frysinger
2008-12-25 1:22 ` Kaz Kojima
3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2008-12-25 0:15 UTC (permalink / raw)
To: linux-sh
[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]
On Wednesday 24 December 2008 17:57:53 Kaz Kojima wrote:
> Mike Frysinger <vapier@gentoo.org> wrote:
> > i dont know superh assembly, so i cant really check the code myself.
> > starting with at gcc-4.1.2 (at least, gcc-3.4.6 doesnt seem to have this
> > issue), a few objects in libgcc.a lack GNU-stack markings. here is the
> > scanelf output against libgcc.a from gcc-4.3.2. basically, '!WX' just
> > means that the objects do not have a .note.GNU-stack section.
> > assuming libgcc doesnt actually use the stack to exec code, the attached
> > patch should fix things i think.
>
> Thanks for pointing this out.
i'm guessing that means they're correct :)
> Could you please send your
> patches to gcc-patches or file this issue to gcc bugzilla?
i dont think people like it when i post patches to bugzilla. they tell me to
use gcc-patches.
> Unfortunately, now gcc trunk is in stage 4 and any patches
> for non strict regressions can't be accepted temporary.
> I'll schedule these patches for 4.5, then apply them to
> the open branches after 4.5.
well, i would say this is a long standing regression. gcc-3.4.6 does not
result in exec stacks with any of the libgcc.a math functions ... but you're
the gcc expert.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stack usage with libgcc math funcs
2008-12-24 17:13 stack usage with libgcc math funcs Mike Frysinger
` (2 preceding siblings ...)
2008-12-25 0:15 ` Mike Frysinger
@ 2008-12-25 1:22 ` Kaz Kojima
3 siblings, 0 replies; 5+ messages in thread
From: Kaz Kojima @ 2008-12-25 1:22 UTC (permalink / raw)
To: linux-sh
Mike Frysinger <vapier@gentoo.org> wrote:
> well, i would say this is a long standing regression. gcc-3.4.6 does not
> result in exec stacks with any of the libgcc.a math functions ... but you're
> the gcc expert.
.note.GNU-stack wasn't used in gcc-3.4 era. This type of
problem wouldn't be a "strict" regression, from the compiler's
viewpoint.
Regards,
kaz
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-25 1:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-24 17:13 stack usage with libgcc math funcs Mike Frysinger
2008-12-24 17:28 ` Mike Frysinger
2008-12-24 22:57 ` Kaz Kojima
2008-12-25 0:15 ` Mike Frysinger
2008-12-25 1:22 ` Kaz Kojima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox