diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2016-09-22 17:02:47 +0000 |
---|---|---|
committer | Andre Vieira <avieira@gcc.gnu.org> | 2016-09-22 17:02:47 +0000 |
commit | 0ee70cc0000fe25484cb0d3b2ac2904d2007e5cf (patch) | |
tree | 2b6549bc452c8fe8fec854d66c6c770e37be25f7 /gcc/varasm.c | |
parent | 31e9f857d5408a69bc6c1eac793103c73ce6eed0 (diff) | |
download | gcc-0ee70cc0000fe25484cb0d3b2ac2904d2007e5cf.zip gcc-0ee70cc0000fe25484cb0d3b2ac2904d2007e5cf.tar.gz gcc-0ee70cc0000fe25484cb0d3b2ac2904d2007e5cf.tar.bz2 |
[ARM] Add support for -mpure-code option
gcc/ChangeLog:
2016-09-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
Terry Guo <terry.guo@arm.com>
* target.def (elf_flags_numeric): New target hook.
* targhooks.h (default_asm_elf_flags_numeric): New.
* varasm.c (default_asm_elf_flags_numeric): New.
(default_elf_asm_named_section): Use new target hook.
* config/arm/arm.opt (mpure-code): New.
* config/arm/arm.h (SECTION_ARM_PURECODE): New.
* config/arm/arm.c (arm_asm_init_sections): Add section
attribute to default text section if -mpure-code.
(arm_option_check_internal): Diagnose use of option with
non supported targets and/or options.
(arm_asm_elf_flags_numeric): New.
(arm_function_section): New.
(arm_elf_section_type_flags): New.
* config/arm/elf.h (JUMP_TABLES_IN_TEXT_SECTION): Disable
for -mpure-code.
* gcc/doc/texi (TARGET_ASM_ELF_FLAGS_NUMERIC): New.
* gcc/doc/texi.in (TARGET_ASM_ELF_FLAGS_NUMERIC): Likewise.
gcc/testsuite/ChangeLog:
2016-09-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
Terry Guo <terry.guo@arm.com>
* gcc.target/arm/pure-code/ffunction-sections.c: New.
* gcc.target/arm/pure-code/no-literal-pool.c: New.
* gcc.target/arm/pure-code/pure-code.exp: New.
Co-Authored-By: Terry Guo <terry.guo@arm.com>
From-SVN: r240379
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index ba866ce..72cba86 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6256,6 +6256,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags, tree decl) { char flagchars[11], *f = flagchars; + unsigned int numeric_value = 0; /* If we have already declared this section, we can use an abbreviated form to switch back to it -- unless this section is @@ -6268,31 +6269,38 @@ default_elf_asm_named_section (const char *name, unsigned int flags, return; } - if (!(flags & SECTION_DEBUG)) - *f++ = 'a'; + /* If we have a machine specific flag, then use the numeric value to pass + this on to GAS. */ + if (targetm.asm_out.elf_flags_numeric (flags, &numeric_value)) + snprintf (f, sizeof (flagchars), "0x%08x", numeric_value); + else + { + if (!(flags & SECTION_DEBUG)) + *f++ = 'a'; #if defined (HAVE_GAS_SECTION_EXCLUDE) && HAVE_GAS_SECTION_EXCLUDE == 1 - if (flags & SECTION_EXCLUDE) - *f++ = 'e'; + if (flags & SECTION_EXCLUDE) + *f++ = 'e'; #endif - if (flags & SECTION_WRITE) - *f++ = 'w'; - if (flags & SECTION_CODE) - *f++ = 'x'; - if (flags & SECTION_SMALL) - *f++ = 's'; - if (flags & SECTION_MERGE) - *f++ = 'M'; - if (flags & SECTION_STRINGS) - *f++ = 'S'; - if (flags & SECTION_TLS) - *f++ = TLS_SECTION_ASM_FLAG; - if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE)) - *f++ = 'G'; + if (flags & SECTION_WRITE) + *f++ = 'w'; + if (flags & SECTION_CODE) + *f++ = 'x'; + if (flags & SECTION_SMALL) + *f++ = 's'; + if (flags & SECTION_MERGE) + *f++ = 'M'; + if (flags & SECTION_STRINGS) + *f++ = 'S'; + if (flags & SECTION_TLS) + *f++ = TLS_SECTION_ASM_FLAG; + if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE)) + *f++ = 'G'; #ifdef MACH_DEP_SECTION_ASM_FLAG - if (flags & SECTION_MACH_DEP) - *f++ = MACH_DEP_SECTION_ASM_FLAG; + if (flags & SECTION_MACH_DEP) + *f++ = MACH_DEP_SECTION_ASM_FLAG; #endif - *f = '\0'; + *f = '\0'; + } fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars); |