Date: Wed, 10 Jun 2020 18:41:50 +0200 From: Michael Tuexen <tuexen@freebsd.org> To: "freebsd-current@FreeBSD.org" <freebsd-current@FreeBSD.org> Subject: gcc versus clang issue for 32-bit binaries Message-ID: <128AB51F-0950-448F-8463-12C573C1AA38@freebsd.org>
next in thread | raw e-mail | index | archive | help
Dear all, consider the following program test.c: #include <sys/mman.h> #include <stdio.h> int=20 main(void) { void *p; =09 p =3D mmap((void *)0x20000000, 0x1000000, PROT_READ | PROT_WRITE = | PROT_EXEC, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); printf("p=3D %p\n", p); return (0); } On i386 the following happens: * when compiling it with cc and running it, it crashes. * when compiling it with gcc it runs fine. On amd64 the following happens: * when compiling it with cc -m64 it runs fine. * when compiling it with cc -m32 is crashes. * when compiling it with gcc -m64 it runs fine. * when compiling it with gcc -m32 it runs fine. So why does the above program crash when compiled for 32-bit when using = clang, but runs fine when compiled with gcc. I'm testing this on 32-bit and 64-bit head systems. gcc is from ports. The reason I'm looking into it is that I want to get syzkaller working = on 32-bit with clang. Best regards Michael
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?128AB51F-0950-448F-8463-12C573C1AA38>