memalign

Salman unix at gofree.indigo.ie
Wed Mar 5 13:46:12 UTC 2003


On Tue, 2003-03-04 at 22:19,
> Hello Salman,
> 
> > 
> > One other thing though, I need to have the allocated buffer aligned as
> > well (so that it begins on a memory address evenly divisible by 8192),
> > any idea on how to achieve this?
> 
> The only way to be sure of alignment is, that you allocate 
> 8192 byte more than actually needed. Then you can adjust the 
> pointer you get from the malloc call to fit your alignment 
> needs. 

I wrote my own memalign, but got a duplicate definition error with the
following
/opt/rtems/i386-rtems/include/malloc.h:extern _PTR memalign _PARAMS
((size_t, size_t));

The function seems to be defined there, but when I try to use it I get
the following error at the end:

i386-rtems-gcc --pipe -B/opt/rtems/i386-rtems/pc386/lib/ -specs
bsp_specs -qrtems   -g -Wall  -O4 -g        -DEXPORT_SYMTAB
-DOS_IS_RTEMS -DADAPTER_IS_PCI1 -DLITTLE_ENDIAN -DCPU_ARCH_IS_X86
-DMODULE -D__KERNEL__ -D_KERNEL -D_X86_ -DUNIX -DIRM_INTERNAL
-DDBG          -Wl,-Ttext,0x00100000 -o o-optimize/test.obj 
o-optimize/test.o o-optimize/init.o o-optimize/osif.o o-optimize/pciif.o
o-optimize/irmConfig.o o-optimize/endian.o o-optimize/genadap.o
o-optimize/adstream.o o-optimize/adintr.o o-optimize/adstatus.o
o-optimize/topology.o o-optimize/id.o o-optimize/adapter.o
o-optimize/geninit.o o-optimize/adprobe.o o-optimize/memalloc.o
o-optimize/addma.o o-optimize/att.o o-optimize/adhwmbx.o
o-optimize/list.o o-optimize/dma.o o-optimize/session.o
o-optimize/intr.o o-optimize/adconfig.o o-optimize/nodeinfo.o
o-optimize/switch.o o-optimize/vc.o o-optimize/make_date.o
o-optimize/busif.o o-optimize/mbx.o o-optimize/probe.o
o-optimize/genif.o o-optimize/minor.o o-optimize/lc.o
o-optimize/switch_d505.o o-optimize/switch_d512.o
o-optimize/switch_d515.o o-optimize/switch_lc2.o o-optimize/switch_lm.o
o-optimize/switch_d535.o o-optimize/barriers.o  
/opt/rtems/i386-rtems/pc386/lib/no-dpmem.rel
/opt/rtems/i386-rtems/pc386/lib/no-event.rel
/opt/rtems/i386-rtems/pc386/lib/no-msg.rel
/opt/rtems/i386-rtems/pc386/lib/no-mp.rel
/opt/rtems/i386-rtems/pc386/lib/no-part.rel
/opt/rtems/i386-rtems/pc386/lib/no-signal.rel
/opt/rtems/i386-rtems/pc386/lib/no-timer.rel
/opt/rtems/i386-rtems/pc386/lib/no-rtmon.rel     
o-optimize/memalloc.o: In function `osif_big_alloc':
/home/salman/work/test/memalloc.c:244: undefined reference to `memalign'
o-optimize/memalloc.o: In function `ma_allocBuffer':
/home/salman/work/test/memalloc.c:340: undefined reference to `memalign'
collect2: ld returned 1 exit status
make: *** [o-optimize/test.exe] Error 1

I've included the malloc.h & stdlib.h in my code, and i'm sure it sees
the definition in malloc.h
but I think it can't find the memalign binary object in libraries / ar
archives. I did grep & i386-rtems-nm and I couldn't find it either !

how could the function definition be present without its binary in rtems
libraries / ar archives ? what am i missing ?

Thanks,

Salman




More information about the users mailing list