elf: add PT_RISCV_ATTRIBUTES program header
Attribute is ignored for now. It is supposed to check ABI compatiblity and reject loading incompatible images. Haiku currently do not use multiple ABIs for RISC-V so it is safe to ignore attributes. PT_RISCV_ATTRIBUTES program header is produced by default in GCC 13 and Clang 17. Change-Id: I4659e9bacbf34a2a0bc16b34c2aaa37232d700fa Reviewed-on: https://review.haiku-os.org/c/haiku/+/6948 Reviewed-by: David Karoly <[email protected]> Tested-by: Commit checker robot <[email protected]> Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
@@ -339,6 +339,7 @@ typedef struct {
|
|||||||
|
|
||||||
#define PT_LOPROC 0x70000000
|
#define PT_LOPROC 0x70000000
|
||||||
#define PT_ARM_UNWIND 0x70000001
|
#define PT_ARM_UNWIND 0x70000001
|
||||||
|
#define PT_RISCV_ATTRIBUTES 0x70000003
|
||||||
#define PT_HIPROC 0x7fffffff
|
#define PT_HIPROC 0x7fffffff
|
||||||
|
|
||||||
/* program header segment flags */
|
/* program header segment flags */
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ typedef struct {
|
|||||||
|
|
||||||
#define PT_LOPROC 0x70000000
|
#define PT_LOPROC 0x70000000
|
||||||
#define PT_ARM_UNWIND 0x70000001
|
#define PT_ARM_UNWIND 0x70000001
|
||||||
|
#define PT_RISCV_ATTRIBUTES 0x70000003
|
||||||
#define PT_HIPROC 0x7fffffff
|
#define PT_HIPROC 0x7fffffff
|
||||||
|
|
||||||
/* program header segment flags */
|
/* program header segment flags */
|
||||||
|
|||||||
@@ -2279,6 +2279,9 @@ load_kernel_add_on(const char *path)
|
|||||||
continue;
|
continue;
|
||||||
case PT_ARM_UNWIND:
|
case PT_ARM_UNWIND:
|
||||||
continue;
|
continue;
|
||||||
|
case PT_RISCV_ATTRIBUTES:
|
||||||
|
// TODO: check ABI compatibility attributes
|
||||||
|
continue;
|
||||||
default:
|
default:
|
||||||
dprintf("%s: unhandled pheader type %#" B_PRIx32 "\n", fileName,
|
dprintf("%s: unhandled pheader type %#" B_PRIx32 "\n", fileName,
|
||||||
programHeaders[i].p_type);
|
programHeaders[i].p_type);
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ count_regions(const char* imagePath, char const* buff, int phnum, int phentsize)
|
|||||||
case PT_ARM_UNWIND:
|
case PT_ARM_UNWIND:
|
||||||
// will be handled in libgcc_s.so.1
|
// will be handled in libgcc_s.so.1
|
||||||
break;
|
break;
|
||||||
|
case PT_RISCV_ATTRIBUTES:
|
||||||
|
// TODO: check ABI compatibility attributes
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FATAL("%s: Unhandled pheader type in count 0x%" B_PRIx32 "\n",
|
FATAL("%s: Unhandled pheader type in count 0x%" B_PRIx32 "\n",
|
||||||
imagePath, pheaders->p_type);
|
imagePath, pheaders->p_type);
|
||||||
@@ -219,6 +222,9 @@ parse_program_headers(image_t* image, char* buff, int phnum, int phentsize)
|
|||||||
case PT_ARM_UNWIND:
|
case PT_ARM_UNWIND:
|
||||||
// will be handled in libgcc_s.so.1
|
// will be handled in libgcc_s.so.1
|
||||||
break;
|
break;
|
||||||
|
case PT_RISCV_ATTRIBUTES:
|
||||||
|
// TODO: check ABI compatibility attributes
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FATAL("%s: Unhandled pheader type in parse 0x%" B_PRIx32 "\n",
|
FATAL("%s: Unhandled pheader type in parse 0x%" B_PRIx32 "\n",
|
||||||
image->path, pheader->p_type);
|
image->path, pheader->p_type);
|
||||||
|
|||||||
Reference in New Issue
Block a user