public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Andre Vieira (lists)" <Andre.SimoesDiasVieira@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>
Subject: Re: [PATCHv2, PING 3][ARM] -mpure-code option for ARM
Date: Tue, 30 Aug 2016 08:01:00 -0000	[thread overview]
Message-ID: <57C53D46.4000306@arm.com> (raw)
In-Reply-To: <57AC87F6.9030808@arm.com>

On 11/08/16 15:13, Andre Vieira (lists) wrote:
> On 25/07/16 11:52, Andre Vieira (lists) wrote:
>> On 11/07/16 17:56, Andre Vieira (lists) wrote:
>>> On 07/07/16 13:30, mickael guene wrote:
>>>> Hi Andre,
>>>>
>>>>  Another feedback on your purecode patch.
>>>>  You have to disable casesi pattern since then it will
>>>> generate wrong code with -mpure-code option.
>>>>  Indeed it will generate an 'adr rx, .Lx' (aka
>>>> 'subs rx, PC, #offset') which will not work in our
>>>> case since 'Lx' label is put in an .rodata section.
>>>> So offset value is unknown and can be impossible
>>>> to encode correctly.
>>>>
>>>> Regards
>>>> Mickael
>>>>
>>>> On 06/30/2016 04:32 PM, Andre Vieira (lists) wrote:
>>>>> Hello,
>>>>>
>>>>> This patch adds the -mpure-code option for ARM. This option ensures
>>>>> functions are put into sections that contain only code and no data. To
>>>>> ensure this throughout compilation we give these sections the ARM
>>>>> processor-specific ELF section attribute "SHF_ARM_PURECODE". This option
>>>>> is only supported for non-pic code for armv7-m targets.
>>>>>
>>>>> This patch introduces a new target hook 'TARGET_ASM_ELF_FLAGS_NUMERIC'.
>>>>> This target hook enables a target to use the numeric value for elf
>>>>> section attributes rather than their alphabetical representation. If
>>>>> TARGET_ASM_ELF_FLAGS_NUMERIC returns TRUE, the existing
>>>>> 'default_elf_asm_named_section', will print the numeric value of the
>>>>> section attributes for the current section. This target hook has two
>>>>> parameters:
>>>>> unsigned int FLAGS, the input parameter that tells the function the
>>>>> current section's attributes;
>>>>> unsigned int *NUM, used to pass down the numerical representation of the
>>>>> section's attributes.
>>>>>
>>>>> The default implementation for TARGET_ASM_ELF_FLAGS_NUMERIC will return
>>>>> false, so existing behavior is not changed.
>>>>>
>>>>> Bootstrapped and tested for arm-none-linux-gnueabihf. Further tested for
>>>>> arm-none-eabi with a Cortex-M3 target.
>>>>>
>>>>>
>>>>> gcc/ChangeLog:
>>>>> 2016-06-30  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-06-30  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.
>>>>>
>>>>
>>> Hi Sandra, Mickael,
>>>
>>> Thank you for your comments. I changed the description of -mpure-code in
>>> invoke.texi to better reflect the error message you get wrt supported
>>> targets.
>>>
>>> As for the target hook description, I hope the text is clearer now. Let
>>> me know if you think it needs further explanation.
>>>
>>> I also fixed the double '%' in the text string for unnamed text sections
>>> and disabled the casesi pattern.
>>>
>>> I duplicated the original casesi test
>>> 'gcc/testsuite/gcc.c-torture/compile/pr46934.c' for pure-code to make
>>> sure the casesi was disabled and other patterns were selected instead.
>>>
>>> Reran regressions for pure-code.exp for Cortex-M3.
>>>
>>> Cheers,
>>> Andre
>>>
>>>
>>> gcc/ChangeLog:
>>> 2016-07-11  Andre Vieira  <andre.simoesdiasvieira@arm.com>
>>>             Terry Guo  <terry.guo@arm.com>
>>>
>>>         * target.def (elf_flags_numeric): New target hook.
>>>         * hooks.c (hook_uint_uintp_false): New generic hook.
>>>         * varasm.c (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.
>>>         * config/arm/arm.md (casesi): Disable pattern 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-07-11  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/no-casesi.c: New.
>>>         * gcc.target/arm/pure-code/pure-code.exp: New.
>>>
>> Ping.
>>
> Ping
> 

Ping

  reply	other threads:[~2016-08-30  8:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 14:46 [PATCH][ARM] " Andre Vieira (lists)
2016-07-01 19:04 ` Sandra Loosemore
2016-07-07 12:29 ` mickael guene
2016-07-07 12:31 ` mickael guene
2016-07-11 16:57   ` [PATCHv2][ARM] " Andre Vieira (lists)
2016-07-25 10:52     ` [PATCHv2, PING][ARM] " Andre Vieira (lists)
2016-08-11 14:13       ` [PATCHv2, PING 2][ARM] " Andre Vieira (lists)
2016-08-30  8:01         ` Andre Vieira (lists) [this message]
2016-09-19  9:25           ` [PATCHv2, PING 4][ARM] " Andre Vieira (lists)
2016-09-22 14:22     ` [PATCHv2][ARM] " Richard Earnshaw (lists)
2016-09-22 15:10       ` [PATCHv3][ARM] " Andre Vieira (lists)
2016-09-22 15:47         ` Richard Earnshaw (lists)
2016-09-22 17:24           ` Andre Vieira (lists)
2016-09-22 19:34             ` Christophe Lyon
2016-09-22 20:05             ` Bill Seurer
2016-09-22 20:30               ` Martin Sebor
2016-09-22 20:20             ` Paolo Carlini
2016-09-23 13:47         ` [PATCH, arm-embedded] " Andre Vieira (lists)
2016-09-23  6:31       ` [PATCHv2][ARM] " Sandra Loosemore
2016-09-23  8:51         ` Andre Vieira (lists)
2016-09-23 10:41           ` Andre Vieira (lists)
2016-09-23 15:12             ` Sandra Loosemore
2016-10-04 13:24               ` mickael guene
2016-10-04 14:15                 ` Andre Vieira (lists)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57C53D46.4000306@arm.com \
    --to=andre.simoesdiasvieira@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).