MicroBlaze resolve section change issues for ident output

Message ID 20180111135423.31423-1-nathan@nathanrossi.com
State New
Headers show
Series
  • MicroBlaze resolve section change issues for ident output
Related show

Commit Message

Nathan Rossi Jan. 11, 2018, 1:54 p.m.
Change 'microblaze_asm_output_ident' so that instead of just switching
section to .sdata2/.rodata it uses the assembler .pushsection and
.popsection directives to preserve the section context when emitting the
ident string content.

This resolves issues associated with the use of the .sdata2/.rodata
operation in cases where emitted assembly after the ident output is
incorrectly in the .sdata2/.rodata section instead of .text or any other
expected section. This results in assembly failures including operations
with symbols across different segments.

gcc/ChangeLog

2018-01-11  Nathan Rossi  <nathan@nathanrossi.com>

        PR target/83013
        * config/microblaze/microblaze.c (microblaze_asm_output_ident):
        Use .pushsection/.popsection
---
 gcc/config/microblaze/microblaze.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jeff Law Jan. 15, 2018, 6:02 a.m. | #1
On 01/11/2018 06:54 AM, Nathan Rossi wrote:
> 2018-01-11  Nathan Rossi  <nathan@nathanrossi.com>
> 
>         PR target/83013
>         * config/microblaze/microblaze.c (microblaze_asm_output_ident):
>         Use .pushsection/.popsection
THanks.  Installed on the trunk.

jeff

Patch

diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index 51511ca2fc..9a4a287be2 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -3394,7 +3394,9 @@  microblaze_asm_output_ident (const char *string)
   else
     section_asm_op = READONLY_DATA_SECTION_ASM_OP;
 
-  buf = ACONCAT ((section_asm_op, "\n\t.ascii \"", string, "\\0\"\n", NULL));
+  buf = ACONCAT (("\t.pushsection", section_asm_op,
+                  "\n\t.ascii \"", string, "\\0\"\n",
+                  "\t.popsection\n", NULL));
   symtab->finalize_toplevel_asm (build_string (strlen (buf), buf));
 }