public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/9571: PowerPC -- problems with 'const', -msdata=eabi and sections.
@ 2003-02-04 14:06 osv
  0 siblings, 0 replies; only message in thread
From: osv @ 2003-02-04 14:06 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-04 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-04 14:06 target/9571: PowerPC -- problems with 'const', -msdata=eabi and sections osv

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).