public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: osv@javad.ru
To: gcc-gnats@gcc.gnu.org
Subject: target/9571: PowerPC -- problems with 'const', -msdata=eabi and sections.
Date: Tue, 04 Feb 2003 14:06:00 -0000	[thread overview]
Message-ID: <20030204140027.25215.qmail@sources.redhat.com> (raw)


>Number:         9571
>Category:       target
>Synopsis:       PowerPC -- problems with 'const', -msdata=eabi and sections.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 04 14:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Sergei Organov
>Release:        gcc version 3.3 20030203 (prerelease)
>Organization:
>Environment:
Linux 2.4.20 i686
>Description:
Given the code:

$ cat const.cc
extern double const d;
double const d = 3.14;
double f() { return d; }
$ ~/try/tools/bin/ppc-rtems-gcc -meabi -msdata=eabi -c -O4 -save-temps -mregnames const.cc -o const.o
const.s: Assembler messages:
const.s:3: Warning: setting incorrect section attributes for .sdata2
$ cat const.s
	.file	"const.cc"
	.globl d
	.section	.sdata2,"aw",@progbits
	.align 3
	.type	d, @object
	.size	d, 8
d:
	.long	1074339512
	.long	1374389535
	.section	.rodata.cst8,"aM",@progbits,8
	.align 3
.LC0:
	.long	1074339512
	.long	1374389535
	.section	".text"
	.align 2
	.globl _Z1fv
	.type	_Z1fv, @function
_Z1fv:
.LFB3:
	lis %r3,.LC0@ha
	lfd %f1,.LC0@l(%r3)
	blr
.LFE3:
	.size	_Z1fv, .-_Z1fv
	.ident	"GCC: (GNU) 3.3 20030203 (prerelease)"


Problems: 

1. Attempt to set "w" attribute for read-only section '.sdata2'.
2. A copy of value of 'd' is put into section '.rodata.cst8'.
   The latter should better go away entirely or at least be 
   '.sdata2.cst8', I think.
3. As a consequence of (2) function f() needs 2 insns instead 
   of 1 to load the constant into register.

For comparison consider perfect code generated in this case:

$ cat var.cc
extern double d;
double d = 3.14;
double f() { return d; }
$ ~/try/tools/bin/ppc-rtems-gcc -meabi -msdata=eabi -c -O4 -save-temps -mregnames var.cc -o var.o
$ cat var.s
	.file	"var.cc"
	.globl d
	.section	.sdata,"aw",@progbits
	.align 3
	.type	d, @object
	.size	d, 8
d:
	.long	1074339512
	.long	1374389535
	.section	".text"
	.align 2
	.globl _Z1fv
	.type	_Z1fv, @function
_Z1fv:
.LFB3:
	lfd %f1,d@sda21(%r0)
	blr
.LFE3:
	.size	_Z1fv, .-_Z1fv
	.ident	"GCC: (GNU) 3.3 20030203 (prerelease)"
>How-To-Repeat:
Refer to description.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2003-02-04 14:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030204140027.25215.qmail@sources.redhat.com \
    --to=osv@javad.ru \
    --cc=gcc-gnats@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).