[Cbe-oss-dev] memalign weirdness in newlib

Patrick Mansfield patmans at us.ibm.com
Tue Jan 8 04:09:09 EST 2008


[adding newlib list ...]

On Sat, Jan 05, 2008 at 10:59:12AM +1100, Michael Ellerman wrote:

> Yeah you're right, that was a stupid test case I whipped up, here's a
> fixed version:
> 
> int main(uint64_t spe_id, uint64_t data, uint64_t env)
> {
>         void *p, *q;
>         int i;
> 
>         for (i = 0x10; i < 0x90; i *= 2) {
>                 p = memalign(i, 0x1000);
>                 q = memalign(i, 0x1000);
>                 printf("align = 0x%x p = %p q = %p\n", i, p, q);
>         }
> 
>         return 0;
> }
> 
> And the output:
> 
> [michael at schoenaich bug]$ ./memalign 
> align = 0x10 p = 0x1c20 q = 0x2e20
> align = 0x20 p = 0x3e20 q = 0x4e60
> align = 0x40 p = 0x5ec0 q = 0x5ec0
> align = 0x80 p = 0x5f00 q = 0x5f00
> 
> 
> Which is still broken AFAICT, for alignments > 0x20.

Looks like a newlib bug.

I tried your test case with mainline newlib, and get similar results, I
only tried for SPU (CELL).

I am still working on memalign for the SPU specific malloc (a different
problem, and not a bug in mainline newlib).

I failed so far trying to build newlib for ppc with linux (using Fedora
8), does anyone have build info for that (configure and make options)?

-- Patrick Mansfield



More information about the cbe-oss-dev mailing list