bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

host-cpu-c-abi: Port to CHERI


From: Bruno Haible
Subject: host-cpu-c-abi: Port to CHERI
Date: Thu, 09 Nov 2023 12:44:22 +0100

On CheriBSD, the original arm64 ABI and the CheriABI are different: When I
attempt to link a program with the libc from the other ABI, a runtime error
ensues. For example, a program with the original arm64 ABI linked against
the libc of the CheriABI:

$ clang hello.c -Wl,-rpath,/lib
$ ldd a.out
a.out:
        libc.so.7 => not found (0x200000)
$ ./a.out 
ld-elf64.so.1: /usr/home/haible/a.out: cannot load /lib/libc.so.7 since it is 
CheriABI

And the other way around, a program with the CheriABI linked against the
original ABI's libc:

$ cc hello.c -Wl,-rpath,/usr/lib64
$ ldd a.out
a.out:
        libc.so.7 => not found (0x100000)
$ ./a.out 
ld-elf.so.1: /usr/home/haible/a.out: cannot load /usr/lib64/libc.so.7 since it 
is not CheriABI

Therefore in the configure results of the 'host-cpu-c-abi' module:

  gl_cv_host_cpu_c_abi=${gl_cv_host_cpu_c_abi=aarch64c}
  gl_cv_host_cpu_c_abi_32bit=${gl_cv_host_cpu_c_abi_32bit=unknown}

the first line is correct; however the second line can be improved.
The patch below does this. It results in

  gl_cv_host_cpu_c_abi=${gl_cv_host_cpu_c_abi=aarch64c}
  gl_cv_host_cpu_c_abi_32bit=${gl_cv_host_cpu_c_abi_32bit=no}


2023-11-09  Bruno Haible  <bruno@clisp.org>

        host-cpu-c-abi: Port to CHERI.
        * m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI_32BIT): Treat aarch64c like
        aarch64.

diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
index 134f228341..3a2f01dfb2 100644
--- a/m4/host-cpu-c-abi.m4
+++ b/m4/host-cpu-c-abi.m4
@@ -1,4 +1,4 @@
-# host-cpu-c-abi.m4 serial 15
+# host-cpu-c-abi.m4 serial 16
 dnl Copyright (C) 2002-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -468,10 +468,11 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT]
   AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
     [if test -n "$gl_cv_host_cpu_c_abi"; then
+       dnl gl_HOST_CPU_C_ABI has already been run. Use its result.
        case "$gl_cv_host_cpu_c_abi" in
          i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | 
mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
            gl_cv_host_cpu_c_abi_32bit=yes ;;
-         x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | 
powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+         x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | mips64 | 
powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
            gl_cv_host_cpu_c_abi_32bit=no ;;
          *)
            gl_cv_host_cpu_c_abi_32bit=unknown ;;
@@ -535,7 +536,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT]
              [gl_cv_host_cpu_c_abi_32bit=yes])
            ;;
 
-         arm* | aarch64 )
+         arm* | aarch64 | aarch64c )
            # Assume arm with EABI.
            # On arm64 systems, the C compiler may be generating code in one of
            # these ABIs:






reply via email to

[Prev in Thread] Current Thread [Next in Thread]