From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26733 invoked by alias); 4 Feb 2003 14:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 26713 invoked by uid 71); 4 Feb 2003 14:06:01 -0000 Resent-Date: 4 Feb 2003 14:06:01 -0000 Resent-Message-ID: <20030204140601.26712.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, osv@javad.ru Received: (qmail 25216 invoked by uid 48); 4 Feb 2003 14:00:27 -0000 Message-Id: <20030204140027.25215.qmail@sources.redhat.com> Date: Tue, 04 Feb 2003 14:06:00 -0000 From: osv@javad.ru Reply-To: osv@javad.ru To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: target/9571: PowerPC -- problems with 'const', -msdata=eabi and sections. X-SW-Source: 2003-02/txt/msg00189.txt.bz2 List-Id: >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: