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]

Re: tst-pthread-getattr changes break sparc


On Fri, 27 Jul 2012 07:10:05 -0700, Richard wrote:
> Sparc isn't the only target that allocates OS stuff below the pointer
> you get back from alloca.  It's just the only one that can use that
> space at non-deterministic times.
> 
> Sparc, PPC64, HPPA, Tile, s390, all define STACK_POINTER_OFFSET in
> gcc.
> 
> You may well have to mirror that definition in your test and probe
> below the pointer you get back from alloca.  Or probe the hard stack
> pointer register instead (at which point you'll have to take sparc64
> stack bias into account too).

Thanks, I'll use the STACK_POINTER_OFFSETs here (I hope this is not
overkill for a test case), adjusted to the fact that the compiler always
adds BIGGEST_ALIGNMENT to the requested size, thus sending the stack
pointer beyond the rlimit by 16 bytes on my x86_64 box. This should
probably be fixed -- seems to be happening because of a bug in
allocate_dynamic_stack_space() in gcc. The following (untested) patch
should fix it. I'll post it on gcc-patches once I verify that it works
correctly.

Regards,
Siddhesh

diff --git a/gcc/explow.c b/gcc/explow.c
index 1cfe93b..ba2b86f 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -1267,8 +1267,7 @@ allocate_dynamic_stack_space (rtx size, unsigned
size_align, extra_align = BITS_PER_UNIT;
     }
 
-  /* ??? STACK_POINTER_OFFSET is always defined now.  */
-#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET)
+#if defined (STACK_DYNAMIC_OFFSET) || STACK_POINTER_OFFSET
   must_align = true;
   extra_align = BITS_PER_UNIT;
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]