]> gcc.gnu.org Git - gcc.git/commit
pdp11: Fix handling of common (local and global) vars [PR94134]
authorJakub Jelinek <jakub@redhat.com>
Wed, 11 Mar 2020 17:35:13 +0000 (18:35 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 17 Sep 2020 14:20:25 +0000 (16:20 +0200)
commit4910b2e4cfe25c95fef18cf54125b788c190cfb2
treeadf05804602c16dbcd41dd1b96c017d18a3fe17f
parent5f6826f724348c4e1317c15ea4cea01d5604fc39
pdp11: Fix handling of common (local and global) vars [PR94134]

As mentioned in the PR, the generic code decides to put the a variable into
lcomm_section, which is a NOSWITCH section and thus the generic code doesn't
switch into a particular section before using
ASM_OUTPUT{_ALIGNED{,_DECL}_}_LOCAL, on many targets that results just in
.lcomm (or for non-local .comm) directives which don't need a switch to some
section, other targets put switch_to_section (bss_section) at the start of
that macro.
pdp11 doesn't do that (and doesn't have bss_section), and so emits the
lcomm/comm variables in whatever section is current (it has only .text/.data
and for DEC assembler rodata).

The following patch fixes that by putting it always into data section, and
additionally avoids emitting an empty line in the assembly for the lcomm
vars.

2020-03-11  Jakub Jelinek  <jakub@redhat.com>

PR target/94134
* config/pdp11/pdp11.c (pdp11_asm_output_var): Call switch_to_section
at the start to switch to data section.  Don't print extra newline if
.globl directive has not been emitted.

* gcc.c-torture/execute/pr94134.c: New test.

(cherry picked from commit f1125cf88ac0c97d819e4f81d556fbcd1161270e)
gcc/config/pdp11/pdp11.c
gcc/testsuite/gcc.c-torture/execute/pr94134.c [new file with mode: 0644]
This page took 0.063573 seconds and 5 git commands to generate.