From 50264baafcfd6d363d6aacdabd80a86f39cd7c9a Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 8 Dec 2021 10:58:16 +0900 Subject: [PATCH 1/9] add armhf test for bionic and focal, to check https://build.ros.org/job/Nbin_ufhf_uFhf__euslisp__ubuntu_focal_armhf__binary/23/consoleFull --- .github/workflows/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index deebc8fb7..c73c8335b 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -27,6 +27,8 @@ jobs: ROS_DISTRO: noetic - DOCKER_IMAGE: osrf/ubuntu_armhf:trusty - DOCKER_IMAGE: osrf/ubuntu_armhf:xenial + - DOCKER_IMAGE: osrf/ubuntu_armhf:bionic + - DOCKER_IMAGE: osrf/ubuntu_armhf:focal - DOCKER_IMAGE: osrf/ubuntu_arm64:trusty - DOCKER_IMAGE: osrf/ubuntu_arm64:xenial - DOCKER_IMAGE: osrf/ubuntu_arm64:bionic From cfeca7507265a8851d349c4a269172a7a720a59e Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 8 Dec 2021 19:04:36 +0900 Subject: [PATCH 2/9] use gcc -dumpmachine , instead of uname -m beacuase uname -m returns host architecutre within docker environment so if you run arm7v compile on docker/arm64, it returns aarch64, that confusis ros build farm https://build.ros.org/job/Nbin_ufhf_uFhf__euslisp__ubuntu_focal_armhf__binary/ --- lisp/Makefile.LinuxARM | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/Makefile.LinuxARM b/lisp/Makefile.LinuxARM index 2929dcd21..039c8a994 100644 --- a/lisp/Makefile.LinuxARM +++ b/lisp/Makefile.LinuxARM @@ -36,7 +36,14 @@ XVERSION=X_V11R6_1 #MACHINE=armv6 #MACHINE=armv5te -MACHINE=$(shell uname -m | sed 's/\(armv[0-9]\).*/\1/') +GCC_MACHINE=$(shell gcc -dumpmachine) +$(info "-- GCC_MACHINE = ${GCC_MACHINE}") +ifneq (, $(findstring aarch64,$(GCC_MACHINE))) + MACHINE=aarch64 +else ifneq (, $(findstring arm,$(GCC_MACHINE))) + MACHINE=armv7 +endif +$(info "-- MACHINE = ${MACHINE}") GCC_MAJOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\)\([\.0-9]*\)/\1/') GCC_MINOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\)\([\.0-9]*\)/\2/') From 8d89df2cc6bca0d4b9458bd12c333741a24b0632 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Thu, 9 Dec 2021 19:11:33 +0900 Subject: [PATCH 3/9] debug k-okada/armhf_focal --- .github/workflows/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index c73c8335b..8f8c778af 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -87,7 +87,7 @@ jobs: if [[ "$QEMU" != "" ]]; then sudo apt-get install -y -qq qemu-user-static; ls /usr/bin/qemu-*-static; export QEMU_VOLUME="-v /usr/bin/qemu-$QEMU-static:/usr/bin/qemu-$QEMU-static" ; fi if [[ "$QEMU" != "" ]]; then docker run --rm --privileged multiarch/qemu-user-static:register; fi if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then sudo apt-get install -y -qq qemu-user-static; fi - if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then git clone http://github.com/euslisp/jskeus ${HOME}/jskeus; fi + if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then git clone http://github.com/k-okada/jskeus ${HOME}/jskeus -b armhf_focal; fi echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME on $QEMU_VOLUME" docker run --rm $QEMU_VOLUME -v $HOME:$HOME -e "QEMU=$QEMU" -e "TRAVIS_OS_NAME=$TRAVIS_OS_NAME" -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -e "MAKEFLAGS=$MAKEFLAGS" -e "DOCKER_IMAGE=$DOCKER_IMAGE" -t $DOCKER_IMAGE sh -c "cd $CI_SOURCE_PATH; ./.travis.sh" From fb59fa5824df1282c34cba31c1d9afb457b145f7 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 10 Jan 2022 17:35:39 +0900 Subject: [PATCH 4/9] install qemu 6.0 to resolve sgfault error on armhf/{trusty/xenial} --- .github/workflows/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 8f8c778af..a96e01763 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -84,6 +84,8 @@ jobs: export ROS_DISTRO=${{matrix.ROS_DISTRO}} export QEMU=${{matrix.QEMU}} export MAKEFLAGS="-j4" + if [[ "$DOCKER_IMAGE" == *"armhf"* ]]; then sudo add-apt-repository -y ppa:canonical-server/server-backports; fi # install qemu 6.0 to fix segfault / https://askubuntu.com/a/1344079 + if [[ "$QEMU" != "" || "$DOCKER_IMAGE" == *"arm"* ]]; then sudo apt update -y -qq; fi if [[ "$QEMU" != "" ]]; then sudo apt-get install -y -qq qemu-user-static; ls /usr/bin/qemu-*-static; export QEMU_VOLUME="-v /usr/bin/qemu-$QEMU-static:/usr/bin/qemu-$QEMU-static" ; fi if [[ "$QEMU" != "" ]]; then docker run --rm --privileged multiarch/qemu-user-static:register; fi if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then sudo apt-get install -y -qq qemu-user-static; fi From c8a5899b32c5ab30e93ac15d02a0c24a65a88f2d Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Thu, 23 Dec 2021 15:43:47 +0900 Subject: [PATCH 5/9] armhf bionic/focal crashes on eval.c(call_foreign), but it solved by disabling tree-vrp optimiation --- lisp/Makefile.LinuxARM | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/Makefile.LinuxARM b/lisp/Makefile.LinuxARM index 039c8a994..1fe1abfad 100644 --- a/lisp/Makefile.LinuxARM +++ b/lisp/Makefile.LinuxARM @@ -111,7 +111,7 @@ THREADDEP=mthread_posix.c #THREADDEP=pthreads.c # If you don't like optimization, comment out the next line. -OFLAGS=-O2 +OFLAGS=-O2 -fno-tree-vrp # link-editor's default flags ?-rdynamic SOFLAGS= -shared -Xlinker -build-id From 800f69e3375f9957a4dc861193545d56e30e0608 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Thu, 9 Dec 2021 19:10:34 +0900 Subject: [PATCH 6/9] use 64bit data within ARM 32bit code fix eval.c: In function 'call_foreign': eval.c:1114:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 1114 | ifunc = (eusinteger_t (*)())((((eusinteger_t)ifunc)&0xffffffff00000000) | ^ --- lisp/c/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/c/eval.c b/lisp/c/eval.c index 400625124..1b3f8665f 100644 --- a/lisp/c/eval.c +++ b/lisp/c/eval.c @@ -1111,8 +1111,8 @@ pointer args[]; double f; if (code->c.fcode.entry2 != NIL) { - ifunc = (eusinteger_t (*)())((((eusinteger_t)ifunc)&0xffffffff00000000) - | (intval(code->c.fcode.entry2)&0x00000000ffffffff)); + ifunc = (eusinteger_t (*)())((((eusinteger_t)ifunc)&0xffff0000) + | (intval(code->c.fcode.entry2)&0x0000ffff)); /* R.Hanai 090726 */ } while (iscons(paramtypes)) { From 6404c3bda632d05525a85699b68626336e908bdf Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 8 Dec 2021 21:28:49 +0900 Subject: [PATCH 7/9] charmacro functions did not put on 4-byte alignment, with -falign-function options on recent armhf compilers --- lisp/c/reader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/c/reader.c b/lisp/c/reader.c index 946b432a2..08e1dfbe5 100644 --- a/lisp/c/reader.c +++ b/lisp/c/reader.c @@ -640,8 +640,8 @@ char token[]; subchar=to_upper(ch); macrofunc=Spevalof(QREADTABLE)->c.rdtab.dispatch->c.vec.v[subchar]; if (macrofunc==NIL) error(E_USER,(pointer)"no # macro defined"); - if (isint(macrofunc)) { /*internal macro*/ - intmac=(pointer (*)())(intval(macrofunc)); + if (isint(macrofunc)||isbignum(macrofunc)) { /*internal macro*/ + intmac=(pointer (*)())(bigintval(macrofunc)); result=(*intmac)(ctx,f,val,subchar,token);} else { vpush(f); vpush(makeint(subchar)); vpush(makeint(val)); @@ -991,8 +991,8 @@ register pointer ins; case ch_termmacro: case ch_nontermacro: macrofunc=Spevalof(QREADTABLE)->c.rdtab.macro->c.vec.v[ch]; if (macrofunc==NIL) error(E_USER,(pointer)"no char macro defined"); - if (isint(macrofunc)) { /*internal macro*/ - intmac=(pointer (*)())(intval(macrofunc)); + if (isint(macrofunc)||isbignum(macrofunc)) { /*internal macro*/ + intmac=(pointer (*)())(bigintval(macrofunc)); result=(*intmac)(ctx,ins,ch,token);} else { vpush(ins); vpush(makeint(ch)); From c1f06464136881af344bdbc84436358913c0afe8 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 12 Dec 2021 08:34:59 +0000 Subject: [PATCH 8/9] increse catcom size --- lisp/tool/gccls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/tool/gccls.c b/lisp/tool/gccls.c index d6979af49..bc93aab3f 100644 --- a/lisp/tool/gccls.c +++ b/lisp/tool/gccls.c @@ -29,7 +29,7 @@ int main(argc,argv) int argc; char *argv[]; { - char *lispfn, cfn[128], hfn[128], tempfn[128], catcom[256], entryname[128]; + char *lispfn, cfn[128], hfn[128], tempfn[128], catcom[512], entryname[128]; FILE *in, *out; char *s, *d, ch; int i,j,k, string_count; From 6d9bff8c55cf4b509d75fa4d2c64c71aa355747d Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Tue, 11 Jan 2022 12:12:08 +0000 Subject: [PATCH 9/9] memory.c: check cp==NULL before we update minmemory, maxmemory --- lisp/c/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/c/memory.c b/lisp/c/memory.c index a00641baa..a73cc0de1 100644 --- a/lisp/c/memory.c +++ b/lisp/c/memory.c @@ -83,6 +83,7 @@ register int k; set_heap_range((unsigned int)cp, (unsigned int)cp + (s+2)*sizeof(pointer)+(sizeof(pointer)-1)); #endif + if (cp==NULL) return(ERR); /*can't allocate new memory*/ #if Linux || Cygwin || Darwin if (minmemory > (char *)cp) minmemory = (char *)cp; if (maxmemory < (char *)sbrk(0)) maxmemory = (char *)sbrk(0); @@ -91,7 +92,6 @@ register int k; maxmemory=(char *)sbrk(0); #endif if (QDEBUG && debug) fprintf(stderr,";; maxmemory=%p\n",maxmemory); - if (cp==NULL) return(ERR); /*can't allocate new memory*/ #if alpha if( chunklist == NULL ) { top_addr = (eusinteger_t)cp;