From owner-freebsd-riscv@freebsd.org Thu Nov 28 02:20:50 2019 Return-Path: Delivered-To: freebsd-riscv@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14CBD1C0ACA for ; Thu, 28 Nov 2019 02:20:50 +0000 (UTC) (envelope-from dclarke@blastwave.org) Received: from jax4mhob13.myregisteredsite.com (jax4mhob13.myregisteredsite.com [64.69.218.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.registeredsite.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47NhFX5kbHz3QdM for ; Thu, 28 Nov 2019 02:20:48 +0000 (UTC) (envelope-from dclarke@blastwave.org) Received: from mailpod.hostingplatform.com (atl4qobmail01pod2.registeredsite.com [10.30.77.35]) by jax4mhob13.myregisteredsite.com (8.14.4/8.14.4) with ESMTP id xAS2KiLb016397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 27 Nov 2019 21:20:44 -0500 Received: (qmail 15617 invoked by uid 0); 28 Nov 2019 02:20:44 -0000 X-TCPREMOTEIP: 99.253.169.68 X-Authenticated-UID: dclarke@blastwave.org Received: from unknown (HELO ?172.16.35.2?) (dclarke@blastwave.org@99.253.169.68) by 0 with ESMTPA; 28 Nov 2019 02:20:44 -0000 Subject: clang dumps core on FreeBSD rv64imafdc To: Ruslan Bukin , Bruce Hoult Cc: RISC-V SW Dev , freebsd-riscv References: <5bca6745-1c09-3ba7-3b4a-2456ea2e1081@blastwave.org> <20191127135941.GA20804@bsdpad.com> From: Dennis Clarke Message-ID: <2a767be9-c6f6-498b-5054-0e01a912cd7a@blastwave.org> Date: Thu, 28 Nov 2019 02:20:43 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Thunderbird/71.0 MIME-Version: 1.0 In-Reply-To: <20191127135941.GA20804@bsdpad.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47NhFX5kbHz3QdM X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of dclarke@blastwave.org has no SPF policy when checking 64.69.218.93) smtp.mailfrom=dclarke@blastwave.org X-Spamd-Result: default: False [5.22 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; IP_SCORE(0.37)[ipnet: 64.69.218.0/23(0.24), asn: 19871(1.66), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-riscv@freebsd.org]; DMARC_NA(0.00)[blastwave.org]; RBL_MAILSPIKE_WORST(2.00)[93.218.69.64.rep.mailspike.net : 127.0.0.10]; NEURAL_SPAM_MEDIUM(0.96)[0.964,0]; AUTH_NA(1.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_SPAM_LONG(0.99)[0.989,0]; RCVD_IN_DNSWL_NONE(0.00)[93.218.69.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:19871, ipnet:64.69.218.0/23, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_LAST(0.00)[] X-BeenThere: freebsd-riscv@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD on the RISC-V instruction set architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Nov 2019 02:20:50 -0000 On 11/27/19 1:59 PM, Ruslan Bukin wrote: > The gcc we use is not old, but 8.3.0: > http://svn.freebsd.org/ports/head/devel/riscv64-gcc/Makefile > OKay I will go back and have another look at that. For the record clang currently dumps core on FreeBSD rv64imafdc : rv64$ uname -a FreeBSD callisto 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r355009: Mon Nov 25 04:02:43 GMT 2019 root@vesta:/opt/rv64/obj/usr/src/20191122121007/freebsd-riscv/riscv.riscv64/sys/QEMU riscv rv64$ rv64$ /usr/bin/clang --version FreeBSD clang version 9.0.0 (tags/RELEASE_900/final 372316) (based on LLVM 9.0.0) Target: riscv64-unknown-freebsd13.0 Thread model: posix InstalledDir: /usr/bin rv64$ rv64$ rv64$ cat hello.c #include #include #include int main ( int argc, char **argv) { uint64_t foo = 0xfeeddeadbeef; printf ( "have a sandwich %lld\n", foo ); return ( 0x42 ); } rv64$ rv64$ ls -lapbin /usr/bin/cc /usr/bin/clang 613 -r-xr-xr-x 4 0 0 63383544 Nov 26 08:00 /usr/bin/cc 613 -r-xr-xr-x 4 0 0 63383544 Nov 26 08:00 /usr/bin/clang rv64$ rv64$ echo $CC /usr/bin/cc rv64$ echo $CFLAGS -std=iso9899:1999 -O0 -fno-builtin -march=rv64imafdc -mabi=lp64d -mstrict-align rv64$ echo $CPPFLAGS -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTIC -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 rv64$ rv64$ $CC $CFLAGS $CPPFLAGS -E -o hello.i hello.s Seems to produce reasonable output. rv64$ rv64$ $CC $CFLAGS $CPPFLAGS -S -o hello.s hello.i cc: warning: argument unused during compilation: '-mstrict-align' [-Wunused-command-line-argument] Assertion failed: (*(NamedDecl **)&Data == ND && "PointerUnion mangles the NamedDecl pointer!"), function setOnlyValue, file /usr/src/20191122121007/freebsd-riscv/contrib/llvm/tools/clang/include/clang/AST/DeclContextInternals.h, line 103. Stack dump: 0. Program arguments: /usr/bin/cc -cc1 -triple riscv64-unknown-freebsd13.0 -S -disable-free -main-file-name hello.i -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-feature +m -target-feature +a -target-feature +f -target-feature +d -target-feature +c -target-feature +relax -target-abi lp64d -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /home/dclarke/hello.gcno -resource-dir /usr/lib/clang/9.0.0 -O0 -std=iso9899:1999 -fdebug-compilation-dir /home/dclarke -ferror-limit 19 -fmessage-length 132 -fno-builtin -fno-signed-char -fobjc-runtime=gnustep -fdiagnostics-show-option -faddrsig -o hello.s -x cpp-output hello.i 1. /usr/include/stdio.h:459:15: current parser token '>=' 2. /usr/include/stdio.h:458:47: parsing function body '__sputc' 3. /usr/include/stdio.h:458:47: in compound statement ('{}') cc: error: unable to execute command: Abort trap (core dumped) cc: error: clang frontend command failed due to signal (use -v to see invocation) FreeBSD clang version 9.0.0 (tags/RELEASE_900/final 372316) (based on LLVM 9.0.0) Target: riscv64-unknown-freebsd13.0 Thread model: posix InstalledDir: /usr/bin cc: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script. cc: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs. rv64$ rv64$ rv64$ ls -la cc.core -rw------- 1 dclarke devl 12701696 Nov 28 01:24 cc.core rv64$ file cc.core cc.core: ELF 64-bit LSB core file, UCB RISC-V, version 1 (FreeBSD), FreeBSD-style, from '/usr/bin/cc -cc1 -triple riscv64-unknown-freebsd13.0 -S -disable-free -main-file', pid=823 rv64$ So the good news is that your older gcc seems to be working fine. A bit confused about where to find libs but works just fine thus far. rv64$ rv64$ cat hello.c #include #include #include int main ( int argc, char **argv) { uint64_t foo = 0xfeeddeadbeef; printf ( "have a sandwich %lld\n", foo ); return ( 0x42 ); } rv64$ /usr/local/bin/gcc -v -std=iso9899:1999 -O0 -fno-builtin -march=rv64imafdc -mabi=lp64d -L/usr/local/lib -L/lib -o hello hello.c Using built-in specs. COLLECT_GCC=/usr/local/bin/gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/8.2.0/lto-wrapper Target: riscv64-unknown-freebsd12.0 Configured with: /home/br/dev/riscv20181213/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-freebsd12.0 --host=riscv64-unknown-freebsd12.0 --with-build-sysroot=/home/br/riscv-world --without-newlib --without-headers --disable-werror --disable-shared --enable-threads --enable-tls --enable-languages=c,c++ --with-gmp=/home/br/riscv-world/usr/local --with-mpfr=/home/br/riscv-world/usr/local --with-mpc=/home/br/riscv-world/usr/local --disable-libatomic --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-bootstrap --disable-multilib --with-arch=rv64imafdc Thread model: posix gcc version 8.2.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-std=c99' '-O0' '-fno-builtin' '-march=rv64imafdc' '-mabi=lp64d' '-L/usr/local/lib' '-L/lib' '-o' 'hello' /usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/8.2.0/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -march=rv64imafdc -mabi=lp64d -auxbase hello -O0 -std=c99 -version -fno-builtin -o /var/tmp/dclarke/ccGbO6Xa.s GNU C99 (GCC) version 8.2.0 (riscv64-unknown-freebsd12.0) compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/../../../../riscv64-unknown-freebsd12.0/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/include /usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/include-fixed /usr/include End of search list. GNU C99 (GCC) version 8.2.0 (riscv64-unknown-freebsd12.0) compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 4dda19917b6f288652be2776fcfdf247 COLLECT_GCC_OPTIONS='-v' '-std=c99' '-O0' '-fno-builtin' '-march=rv64imafdc' '-mabi=lp64d' '-L/usr/local/lib' '-L/lib' '-o' 'hello' /usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/../../../../riscv64-unknown-freebsd12.0/bin/as -v --traditional-format -march=rv64imafdc -mabi=lp64d -o /var/tmp/dclarke/ccqQ7cBB.o /var/tmp/dclarke/ccGbO6Xa.s GNU assembler version 2.31.1 (riscv64-unknown-freebsd12.0) using BFD version (GNU Binutils) 2.31.1 COMPILER_PATH=/usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/8.2.0/:/usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/8.2.0/:/usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/:/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/:/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/:/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/../../../../riscv64-unknown-freebsd12.0/bin/ LIBRARY_PATH=/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/:/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/../../../../riscv64-unknown-freebsd12.0/lib/:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-std=c99' '-O0' '-fno-builtin' '-march=rv64imafdc' '-mabi=lp64d' '-L/usr/local/lib' '-L/lib' '-o' 'hello' /usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/8.2.0/collect2 -plugin /usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/8.2.0/liblto_plugin.so -plugin-opt=/usr/local/libexec/gcc/riscv64-unknown-freebsd12.0/8.2.0/lto-wrapper -plugin-opt=-fresolution=/var/tmp/dclarke/ccjoEC0T.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -melf64lriscv -V -dynamic-linker /libexec/ld-elf.so.1 -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib -L/lib -L/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0 -L/usr/local/lib/gcc/riscv64-unknown-freebsd12.0/8.2.0/../../../../riscv64-unknown-freebsd12.0/lib /var/tmp/dclarke/ccqQ7cBB.o -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o GNU ld (GNU Binutils) 2.31.1 Supported emulations: elf64lriscv elf32lriscv COLLECT_GCC_OPTIONS='-v' '-std=c99' '-O0' '-fno-builtin' '-march=rv64imafdc' '-mabi=lp64d' '-L/usr/local/lib' '-L/lib' '-o' 'hello' rv64$ ./hello have a sandwich 280297596632815 rv64$ echo $? 66 rv64$ rv64$ rv64$ uname -apKU FreeBSD callisto 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r355009: Mon Nov 25 04:02:43 GMT 2019 root@vesta:/opt/rv64/obj/usr/src/20191122121007/freebsd-riscv/riscv.riscv64/sys/QEMU riscv riscv64 1300061 1300061 rv64$ rv64$ /usr/local/bin/gcc --version gcc (GCC) 8.2.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. rv64$ cat pi.c #define _XOPEN_SOURCE 600 #include #include #include #include int main(int argc, char *argv[]) { long double *pi; int j = 1; /* dummy test integer */ int little_endian = (*(uint8_t*)&j == 1) ? 1 : 0; printf("the sizeof(long double pi) is %lld bytes\n", sizeof(long double) ); pi = calloc ( (size_t)1, sizeof(long double) ); *pi = 3.141592653589793238462643383279502884197L; if (little_endian) { printf("\nThis is a little endian memory machine.\n"); printf("Data in memory may be reversed.\n"); printf("Here is the data in natural human order.\n"); printf("0x%" PRIXPTR " : ", (uintptr_t)pi); for ( j=(sizeof(long double)-1); j>(-1); j-- ) printf("%02x ", (uint8_t)((uint8_t*)pi)[j] ); } else { printf("\nThis is a big endian memory machine.\n"); printf("0x%" PRIXPTR " : ", (uintptr_t)pi); for ( j=0; j