mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-25 08:47:28 +00:00
RISC-V: Add GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS and GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED
This patch adds two new GNU properties for RISC-V: GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS and GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED. We only add readelf and define the properties in this patch. Ref: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/417
This commit is contained in:
@@ -21287,6 +21287,33 @@ decode_aarch64_feature_1_and (unsigned int bitmask)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
decode_riscv_feature_1_and (unsigned int bitmask)
|
||||
{
|
||||
while (bitmask)
|
||||
{
|
||||
unsigned int bit = bitmask & (- bitmask);
|
||||
|
||||
bitmask &= ~ bit;
|
||||
switch (bit)
|
||||
{
|
||||
case GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED:
|
||||
printf ("CFI_LP_UNLABELED");
|
||||
break;
|
||||
|
||||
case GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS:
|
||||
printf ("CFI_SS");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf (_("<unknown: %x>"), bit);
|
||||
break;
|
||||
}
|
||||
if (bitmask)
|
||||
printf (", ");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
decode_1_needed (unsigned int bitmask)
|
||||
{
|
||||
@@ -21477,6 +21504,18 @@ print_gnu_property_note (Filedata * filedata, Elf_Internal_Note * pnote)
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
else if (filedata->file_header.e_machine == EM_RISCV)
|
||||
{
|
||||
if (type == GNU_PROPERTY_RISCV_FEATURE_1_AND)
|
||||
{
|
||||
printf ("RISC-V AND feature: ");
|
||||
if (datasz != 4)
|
||||
printf (_("<corrupt length: %#x> "), datasz);
|
||||
else
|
||||
decode_riscv_feature_1_and (byte_get (ptr, 4));
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user