diff options
-rw-r--r-- | bfd/elfnn-riscv.c | 3 | ||||
-rw-r--r-- | bfd/elfxx-riscv.c | 1 | ||||
-rw-r--r-- | binutils/readelf.c | 3 | ||||
-rw-r--r-- | gas/config/tc-riscv.c | 11 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/ztso.d | 8 | ||||
-rw-r--r-- | include/elf/riscv.h | 3 |
6 files changed, 29 insertions, 0 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 0e0a0b0..3d2ddf4 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -3872,6 +3872,9 @@ _bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) /* Allow linking RVC and non-RVC, and keep the RVC flag. */ elf_elfheader (obfd)->e_flags |= new_flags & EF_RISCV_RVC; + /* Allow linking TSO and non-TSO, and keep the TSO flag. */ + elf_elfheader (obfd)->e_flags |= new_flags & EF_RISCV_TSO; + return true; fail: diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index e03b312..7eda177 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1204,6 +1204,7 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] = {"zvl16384b", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zvl32768b", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zvl65536b", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + {"ztso", ISA_SPEC_CLASS_DRAFT, 0, 1, 0 }, {NULL, 0, 0, 0, 0} }; diff --git a/binutils/readelf.c b/binutils/readelf.c index cafba9a..b1dbcad 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -4079,6 +4079,9 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine) if (e_flags & EF_RISCV_RVE) strcat (buf, ", RVE"); + if (e_flags & EF_RISCV_TSO) + strcat (buf, ", TSO"); + switch (e_flags & EF_RISCV_FLOAT_ABI) { case EF_RISCV_FLOAT_ABI_SOFT: diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 629d4be..b1abc85 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -257,6 +257,14 @@ riscv_set_rvc (bool rvc_value) riscv_opts.rvc = rvc_value; } +/* Turn on the tso flag for elf_flags once we have enabled ztso extension. */ + +static void +riscv_set_tso () +{ + elf_flags |= EF_RISCV_TSO; +} + /* This linked list records all enabled extensions, which are parsed from the architecture string. The architecture string can be set by the -march option, the elf architecture attributes, and the --with-arch @@ -307,6 +315,9 @@ riscv_set_arch (const char *s) riscv_set_rvc (false); if (riscv_subset_supports (&riscv_rps_as, "c")) riscv_set_rvc (true); + + if (riscv_subset_supports (&riscv_rps_as, "ztso")) + riscv_set_tso (); } /* Indicate -mabi option is explictly set. */ diff --git a/gas/testsuite/gas/riscv/ztso.d b/gas/testsuite/gas/riscv/ztso.d new file mode 100644 index 0000000..cb038db --- /dev/null +++ b/gas/testsuite/gas/riscv/ztso.d @@ -0,0 +1,8 @@ +#as: -march=rv64i_ztso +#readelf: -h +#source: empty.s + +ELF Header: +#... +[ ]+Flags:[ ]+0x10, TSO.* +#...
\ No newline at end of file diff --git a/include/elf/riscv.h b/include/elf/riscv.h index 9b3ea37..d7b5c09 100644 --- a/include/elf/riscv.h +++ b/include/elf/riscv.h @@ -121,6 +121,9 @@ END_RELOC_NUMBERS (R_RISCV_max) /* RISC-V specific values for st_other. */ #define STO_RISCV_VARIANT_CC 0x80 +/* File uses the TSO model. */ +#define EF_RISCV_TSO 0x0010 + /* Additional section types. */ #define SHT_RISCV_ATTRIBUTES 0x70000003 /* Section holds attributes. */ |