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.simoesdiasvie...@arm.com>
>>>>             Terry Guo  <terry....@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.simoesdiasvie...@arm.com>
>>>>             Terry Guo  <terry....@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.simoesdiasvie...@arm.com>
>>             Terry Guo  <terry....@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.simoesdiasvie...@arm.com>
>>             Terry Guo  <terry....@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

Reply via email to