Hi!
I am about to try the new release of gcc/morello (Alp2), and I see it now supports Linux. Can someone point me in the right direction to find instructions on how to run small GCC-compiled test binaries in purecap mode? For Clang, I run them under CheriBSD under QEMU. What would be the most straightforward setup to run GCC-generated binaries? Thanks!
Vadim
-- Senior Research Associate Department of Computer Science and Technology University of Cambridge http://zaliva.org/
________________________________ From: Alex Coplan via Gnu-morello gnu-morello@op-lists.linaro.org Sent: Wednesday, June 29, 2022 4:09 To: Vadim Zaliva vz231@cam.ac.uk Cc: gnu-morello@op-lists.linaro.org gnu-morello@op-lists.linaro.org Subject: [Gnu-morello] Re: binary release of the GNU Toolchain for Morello (version: 10.1.Morello-Alp1
Hi Vadim,
On 20/06/2022 14:57, Vadim Zaliva wrote:
Thanks!
If there is a way to compile binaries with gcc to run under CHERIbsd?
Sorry for the delayed reply.
The short answer is no. The current binary release of the toolchain is for baremetal targets, not for hosted environments.
The longer answer is that it might be possible to hack something together for running some simple test programs. The main issues are that, by default, the released GCC will link against newlib and use newlib headers. You'll want to get GCC to use your system's libc headers instead and link against your system libc.
In theory, this could be done by adding -nostdlib -nostdinc to the command line, and then adding the relevant include paths for your system libc and the relevant flags to link against your system libc. You may need a custom spec file to make this work.
If you're just interested in seeing how GCC compiles certain programs (and don't mind which linker you use), it might be easier just to use GCC to compile to object code, and then use your system compiler to link the object files into an executable. That way you'll only need to take care of the includes that GCC sees, and your system toolchain should handle linking with the libc.
If you're feeling particularly adventurous, you could try compiling a GCC from source on CheriBSD, but you'll probably need some patches to make this work. Trying the sort of approach described above is likely to be easier.
I hope that helps.
Thanks, Alex
Vadim
-- Senior Research Associate Department of Computer Science and Technology University of Cambridge https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fzaliva.org%...
From: Alex Coplan via Gnu-morello gnu-morello@op-lists.linaro.org Sent: Monday, June 20, 2022 1:47 To: Vadim Zaliva vz231@cam.ac.uk Cc: gnu-morello@op-lists.linaro.org gnu-morello@op-lists.linaro.org Subject: [Gnu-morello] Re: binary release of the GNU Toolchain for Morello (version: 10.1.Morello-Alp1
Hi Vadim,
On 18/06/2022 01:03, Vadim Zaliva via Gnu-morello wrote:
I am very excited about the binary release of gcc-toolchain, but I run into problems trying to compile something as simple as:
int main() { return 0; }
$ ~/morello-gnu/bin/aarch64-none-elf-gcc -march=morello -O0 -nostdlib hello.c /home/lord/morello-gnu/bin/../lib/gcc/aarch64-none-elf/10.1.0/../../../../aarch64-none-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400000
$ ~/morello-gnu/bin/aarch64-none-elf-gcc -march=morello -O0 hello.c /home/lord/morello-gnu/bin/../lib/gcc/aarch64-none-elf/10.1.0/../../../../aarch64-none-elf/bin/ld: /home/lord/morello-gnu/bin/../lib/gcc/aarch64-none-elf/10.1.0/../../../../aarch64-none-elf/lib/hybridcap/libc.a(lib_a-exit.o): in function `exit': /data/jenkins/workspace/GNU-toolchain/morello-trunk/src/newlib-cygwin/newlib/libc/stdlib/exit.c:70: undefined reference to `_exit' /home/lord/morello-gnu/bin/../lib/gcc/aarch64-none-elf/10.1.0/../../../../aarch64-none-elf/bin/ld: /home/lord/morello-gnu/bin/../lib/gcc/aarch64-none-elf/10.1.0/../../../../aarch64-none-elf/lib/hybridcap/crt0.o: in function `_start': /data/jenkins/workspace/GNU-toolchain/morello-trunk/src/newlib-cygwin/libgloss/aarch64/crt0.S:360: undefined reference to `__init_global_caps' /home/lord/morello-gnu/bin/../lib/gcc/aarch64-none-elf/10.1.0/../../../../aarch64-none-elf/bin/ld: /data/jenkins/workspace/GNU-toolchain/morello-trunk/src/newlib-cygwin/libgloss/aarch64/crt0.S:361: undefined reference to `__processRelocs' /home/lord/morello-gnu/bin/../lib/gcc/aarch64-none-elf/10.1.0/../../../../aarch64-none-elf/bin/ld: /data/jenkins/workspace/GNU-toolchain/morello-trunk/src/newlib-cygwin/libgloss/aarch64/crt0.S:365: undefined reference to `initialise_monitor_handles' collect2: error: ld returned 1 exit status
Any suggestions on what I am doing wrong?
You need to supply a "spec" file to GCC when using the baremetal (aarch64-none-elf) toolchain. I usually tend to use -specs=aem-ve.specs when building small baremetal test programs for Morello.
Also, I think it mentions that pure and hybrid capabilities modes are supported, but I could not find option to specify which one to use.
Yes. For purecap, you need -march=morello+c64 -mabi=purecap. For hybrid, it's just -march=morello.
Hope that helps.
Alex
Thanks!
Vadim
-- Senior Research Associate Department of Computer Science and Technology University of Cambridge https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fzaliva.org%...
-- Gnu-morello mailing list -- gnu-morello@op-lists.linaro.org To unsubscribe send an email to gnu-morello-leave@op-lists.linaro.org
-- Alex -- Gnu-morello mailing list -- gnu-morello@op-lists.linaro.org To unsubscribe send an email to gnu-morello-leave@op-lists.linaro.org