Mail Archives: djgpp/2017/12/29/10:37:43
On 29.12.2017 14:39, Rudolf Marek (r DOT marek AT assembler DOT cz) [via
djgpp AT delorie DOT com] wrote:
> Hi,
>
> I was testing the flashrom DOS port before new release, and it turns out
> there is something wrong with the valloc(). It refuses to allocate larger
> areas, but malloc with same size works fine. The very same code was working fine with the 2.04 from 2009.
1) I tried cross-compiler under ArchLinux (my own versions I should
sometime commit to aur.archlinux.org to update versions already there).
No failures observed when I run cross-compiled exe file in Win 10 32-bit
VM (the same I'm using for building native compiler packages for
ftp.delorie.com)
2) recompiled it Win 10 32-bit VM and observed similar behavior as
described in report
ArchLinux build has additional probably related patch:
https://aur.archlinux.org/cgit/aur.git/tree/nmemalign.patch?h=djgpp-djcrx
I kept the changes (except gcc version compatibility fixes which I
replaced) in my new not yet submitted version
Andris
> I performed my experiment with following rpms installed:
>
> djcross-binutils-2.29.1-1ap.x86_64.rpm
> djcross-gcc-7.2.0-1ap.x86_64.rpm
> djcrx-2.05-5.x86_64.rpm
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <malloc.h>
>
> int main(void)
> {
> printf("VALLOC %lx\n", valloc(1024*1024)); /* Fails with 0 */
> printf("MALLOC %lx\n", malloc(1024)); /* Works fine */
> printf("MALLOC %lx\n", malloc(1024*1024)); /* Works fine */
> printf("VALLOC %lx\n", valloc(1024)); /* Fails with 0 */
> printf("MEMALIGN %lx\n", memalign(4096, 1024)); /* Fails with 0 */
> printf("MEMALIGN %lx\n", memalign(64, 1024)); /* Fails with 0 */
> printf("MEMALIGN %lx\n", memalign(32, 64)); /* Works fine */
> }
>
> I suspect something went wrong with memalign() internally, as for larger allocations it does some advanced trickery.
>
> Thanks
> Rudolf
>
- Raw text -