public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "casner at acm dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/94134] pdp11-aout puts initial variable into .text section rather than .data
Date: Wed, 11 Mar 2020 23:43:53 +0000	[thread overview]
Message-ID: <bug-94134-4-fZOd6aHDf0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94134-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94134

--- Comment #13 from Stephen Casner <casner at acm dot org> ---
(In reply to Stephen Casner from comment #9)
(Commenting on my own comment)
> 1. pdp11-aout does not have a .lcommon or .lcomm section, just .text, .data
> and .bss.  But also I'm missing something about the concept of a
> NOSWITCH_SECTION that you can't switch to with an assembler directive -- how
> do you tell the assembler to assign a variable to that section if you don't
> emit a directive?

The a.out file format produced by the assembler or linker includes only the
.text, .data and .bss sections.  However, that does not mean the compiler could
not pass a .comm or .lcomm directive to the assembler.  I now understand those
and the NOSWITCH concept.  In fact, I found that the Unix v6 cc produces the
.comm directive which I had not seen before:

# cat > static.c
int zero;
int one;
int main() {
    static int two;
    zero = 0;
    one = 1;
    two = 2;
}
# cc -S static.s static.c
# cat static.s
.globl  _zero
.comm   _zero,2
.globl  _one
.comm   _one,2
.globl  _main
.text
_main:
~~main:
.bss
L2:.=.+2
.text
~two=L2
jsr     r5,csv
clr     _zero
mov     $1,_one
mov     $2,L2
L1:jmp  cret
.globl
.data
# 

So presumably the ASM_OUTPUT{_ALIGNED{,_DECL}_}_LOCAL functions could generate
.comm and .lcomm directives to be allocated to the .bss section by as.  I don't
know if there is enough size information in the relocation section of the a.out
file to allow merging global .comm declarations.

  parent reply	other threads:[~2020-03-11 23:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  6:52 [Bug target/94134] New: " casner at acm dot org
2020-03-11  7:05 ` [Bug target/94134] " casner at acm dot org
2020-03-11  7:32 ` pinskia at gcc dot gnu.org
2020-03-11  7:34 ` pinskia at gcc dot gnu.org
2020-03-11  8:26 ` jakub at gcc dot gnu.org
2020-03-11 14:48 ` jakub at gcc dot gnu.org
2020-03-11 14:52 ` jakub at gcc dot gnu.org
2020-03-11 16:57 ` pkoning at gcc dot gnu.org
2020-03-11 17:37 ` jakub at gcc dot gnu.org
2020-03-11 20:14 ` casner at acm dot org
2020-03-11 20:19 ` casner at acm dot org
2020-03-11 21:10 ` pkoning at gcc dot gnu.org
2020-03-11 23:18 ` casner at acm dot org
2020-03-11 23:43 ` casner at acm dot org [this message]
2020-03-17 18:57 ` cvs-commit at gcc dot gnu.org
2020-09-17 14:24 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:18 ` jakub at gcc dot gnu.org
2020-09-18  5:27 ` casner at acm dot org

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=bug-94134-4-fZOd6aHDf0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).