From: Andrew Waterman Date: Fri, 8 Dec 2017 00:44:13 +0000 (+0000) Subject: Add srodata section support to riscv port. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6cb0725cdbef47a7486629b7933f51a29a591781;p=gcc.git Add srodata section support to riscv port. 2017-12-07 Andrew Waterman gcc/ * config/riscv/riscv.c (TARGET_ASM_SELECT_SECTION): New define. (TARGET_HAVE_SRODATA_SECTION): New define. (riscv_select_section): New function. From-SVN: r255491 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 58081c1e46e..b9d7ed742cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-12-07 Andrew Waterman + + * config/riscv/riscv.c (TARGET_ASM_SELECT_SECTION): New define. + (TARGET_HAVE_SRODATA_SECTION): New define. + (riscv_select_section): New function. + 2017-12-08 Joseph Myers Alexander Monakov Jakub Jelinek diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index c7283d02141..cfab2e77686 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -3042,6 +3042,22 @@ riscv_in_small_data_p (const_tree x) return riscv_size_ok_for_small_data_p (int_size_in_bytes (TREE_TYPE (x))); } +/* Switch to the appropriate section for output of DECL. */ + +static section * +riscv_select_section (tree decl, int reloc, + unsigned HOST_WIDE_INT align) +{ + switch (categorize_decl_for_section (decl, reloc)) + { + case SECCAT_SRODATA: + return get_named_section (decl, ".srodata", reloc); + + default: + return default_elf_select_section (decl, reloc, align); + } +} + /* Return a section for X, handling small data. */ static section * @@ -4320,6 +4336,12 @@ riscv_constant_alignment (const_tree exp, HOST_WIDE_INT align) #undef TARGET_IN_SMALL_DATA_P #define TARGET_IN_SMALL_DATA_P riscv_in_small_data_p +#undef TARGET_HAVE_SRODATA_SECTION +#define TARGET_HAVE_SRODATA_SECTION true + +#undef TARGET_ASM_SELECT_SECTION +#define TARGET_ASM_SELECT_SECTION riscv_select_section + #undef TARGET_ASM_SELECT_RTX_SECTION #define TARGET_ASM_SELECT_RTX_SECTION riscv_elf_select_rtx_section