aarch64: morello: fix ldconfig for purecap abi

Add purecap ld cache flag. Add the purecap ld.so name to known names.
Handle lib64c system library paths. And set the purecap abi flag on
cache entries.
This commit is contained in:
Szabolcs Nagy 2022-07-15 08:15:02 +01:00
parent c779cc818e
commit c755eefac5
5 changed files with 23 additions and 1 deletions

View File

@ -210,6 +210,9 @@ print_entry (const char *lib, int flag, uint64_t hwcap,
case FLAG_AARCH64_LIB64:
fputs (",AArch64", stdout);
break;
case FLAG_AARCH64_PURECAP:
fputs (",purecap", stdout);
break;
/* Uses the ARM soft-float ABI. */
case FLAG_ARM_LIBSF:
fputs (",soft-float", stdout);

View File

@ -45,6 +45,7 @@
#define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
#define FLAG_RISCV_FLOAT_ABI_SOFT 0x0f00
#define FLAG_RISCV_FLOAT_ABI_DOUBLE 0x1000
#define FLAG_AARCH64_PURECAP 0x1100
/* Name of auxiliary cache. */
#define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"

View File

@ -20,6 +20,8 @@
#ifdef __LP64__
# define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6)
#elif defined __CHERI_PURE_CAPABILITY__
# define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_PURECAP | FLAG_ELF_LIBC6)
#else
# define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB32 | FLAG_ELF_LIBC6)
#endif
@ -38,6 +40,11 @@
len -= 2; \
path[len] = '\0'; \
} \
if (len >= 7 && ! memcmp (path + len - 7, "/lib64c", 7)) \
{ \
len -= 3; \
path[len] = '\0'; \
} \
if (len >= 9 && ! memcmp (path + len - 9, "/libilp32", 9))\
{ \
len -= 5; \
@ -48,6 +55,8 @@
{ \
memcpy (path + len, "64", 3); \
add_dir (path); \
memcpy (path + len, "64c", 4); \
add_dir (path); \
memcpy (path + len, "ilp32", 6); \
add_dir (path); \
} \

View File

@ -21,6 +21,8 @@
#define SYSDEP_KNOWN_INTERPRETER_NAMES \
{ "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux-aarch64_purecap.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux-aarch64_be_purecap.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \

View File

@ -55,11 +55,18 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
}
else
{
Elf64_Ehdr *elf64_header = (Elf64_Ehdr *) elf_header;
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
/* AArch64 libraries are always libc.so.6+. */
if (!ret)
*flag = FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;
{
if (elf64_header->e_flags & EF_AARCH64_CHERI_PURECAP)
*flag = FLAG_AARCH64_PURECAP|FLAG_ELF_LIBC6;
else
*flag = FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;
}
}
return ret;
}