чт, 19 дек. 2024 г. в 21:56, Georg-Johann Lay <a...@gjlay.de>:
>
> The "io", "io_low", and "address" attributes require to asm output
> the definition of respective symbols in a manner that was not supported
> until the introduction of the new target hook TARGET_ASM_VARIABLE.
>
> The previous implementation of these attributes abused tls_common_section
> which is a noswitch section.  Notice that the middle-end doesn't allow to
> introduce own, custom noswitch sections.
>     The tls_comm_section->noswitch.callback allowed for a custom asm output
> regardless of -f[no-]data-sections and -f[no-]common.  However, it would
> not work with checking enabled due to varasm.cc::assemble_variable()'s
>
>    /* Emulated TLS had better not get this far.  */
>    gcc_checking_assert (targetm.have_tls || !DECL_THREAD_LOCAL_P (decl));
>
> This patch avoids that hack and uses the new TARGET_ASM_VARIABLE target
> hook to output variables with the mentioned attributes.
>
> Ok for trunk?
>

Ok.
Approved.

Denis.

> Johann
>
> --
>
> AVR: target/112952 - Use new TARGET_ASM_VARIABLE for io, io_low, address.
>
> The "io", "io_low", and "address" attributes require to asm output
> the definition of respective symbols in a manner that was not supported
> until the introduction of the new target hook TARGET_ASM_VARIABLE.
>
> The previous implementation of these attributes abused tls_common_section
> which is a noswitch section.  Notice that the middle-end doesn't allow to
> introduce own, custom noswitch sections.
>     The tls_comm_section->noswitch.callback allowed for a custom asm output
> regardless of -f[no-]data-sections and -f[no-]common.  However, it would
> not work with checking enabled due to varasm.cc::assemble_variable()'s
>
>    /* Emulated TLS had better not get this far.  */
>    gcc_checking_assert (targetm.have_tls || !DECL_THREAD_LOCAL_P (decl));
>
> This patch avoids that hack and uses the new TARGET_ASM_VARIABLE target
> hook to output variables with the mentioned attributes.
>
>         PR target/112952
> gcc/
>         * config/avr/avr.cc (avr_output_addr_attrib): Rename and
>         rewrite to avr_asm_variable.
>         (avr_asm_init_sections): Leave tls_comm_section alone.
>         (avr_encode_section_info) [io, io_low, address]: Don't
>         abuse tls_comm_section.
>         (TARGET_ASM_VARIABLE): New define to avr_asm_variable.

Reply via email to