1

I am trying to cross compile a go project (syzkaller) to target a Pi Zero so it can emulate usb devices. The problem is that I have been unable to find information regarding how to specify the proper floating point flag to ensure compatibility with the Pi Zero. Everything I have tried results in the VMOV assembly instruction being in the binary file and throwing an illegal instruction. My host machine is x86_64 running go1.21.4 and the pi zero is arm6l running go1.21.4. When cross compiling I am using GOOS=linux GOARCH=arm GOARM=5. The makefile I am using can be found here: https://github.com/google/syzkaller/blob/master/Makefile (I am compiling the execprog binary). From my research the GOARM=5 should be forcing software floating point operations, but the information sources are very outdated. I have also tried compiling for armv5 with no success. I also could be using the flag incorrectly since I am not very familiar with GO. Below are the exact compilation arguments for the binary. Any advice is appreciated, thanks.

Must remake target 'execprog'. GOOS=linux GOARCH=arm go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.\ GitRevision=121701b62358a454bbfdccfadfcce9bb843602d6+ -X 'github.com/google/syzkaller\ /prog.gitRevisionDate=20240605-134717'" "-tags=syz_target syz_os_linux syz_arch_armv6\ GOARM=5" -o ./bin/linux_arm/syz-execprog github.com/google/syzkaller/tools/syz-execprog 

1 Answer 1

2

GOARM is expected in the environment; the Makefile has no provision for that, but

export GOARM=5 

before the build should do the trick.

Failing that, run

GOOS=linux GOARCH=arm GOARM=5 go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.\ GitRevision=121701b62358a454bbfdccfadfcce9bb843602d6+ -X 'github.com/google/syzkaller\ /prog.gitRevisionDate=20240605-134717'" "-tags=syz_target syz_os_linux syz_arch_armv6" -o ./bin/linux_arm/syz-execprog github.com/google/syzkaller/tools/syz-execprog 

directly.

2
  • Thanks, the export worked. Looking back, am I correct in thinking that my injection into the makefile failed because it was specifying GOARM=5 after the build actually took place? If so, how do the -tags function/affect the compilation? Commented Jun 28, 2024 at 16:51
  • You specified GOARM=5 as an argument to -tags, on the go build command; it didn’t apply after the build, it applied to the build. But GOARM=5 isn’t relevant as a build tag; tags are used to enable or disable parts of a build (e.g. files which are only relevant for Windows). Commented Jun 29, 2024 at 9:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.