public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: tomas@nocrew.org
To: gcc-gnats@gcc.gnu.org
Subject: c/4136: wrong assembler for static variables with -fPIC on powerpc-elf-netbsd
Date: Mon, 27 Aug 2001 06:56:00 -0000	[thread overview]
Message-ID: <20010827135226.17192.qmail@sourceware.cygnus.com> (raw)

>Number:         4136
>Category:       c
>Synopsis:       wrong assembler for static variables with -fPIC on powerpc-elf-netbsd
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 27 06:56:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tomas Berndtsson
>Release:        gcc version 3.1 20010826 (experimental)
>Organization:
>Environment:
Cross compiler for powerpc-elf-netbsd, on host i386--netbsd.
Using builtin specs.
Configured with: ../../gcc-cvs/configure --target=powerpc-elf-netbsd --prefix=/usr/local --enable-languages=c --with-local-prefix=/usr/local/powerpc-elf-netbsd --without-headers --with-newlib
Thread model: single
gcc version 3.1 20010826 (experimental)
 
Cross compiler compiled with:
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
on NetBSD/i386. 
>Description:
This is also verified on gcc 2.95.2 and 2.95.3 as well as 2.95.4 from CVS. 

When compiling a file with option -fPIC, when a static variable is used in a function,
the output assembler code is wrong. Compiling with -fpic or no such option works.

The resulting error message from gas is: 
/var/tmp//ccG6GMLk.s: Assembler messages:
/var/tmp//ccG6GMLk.s:28: Error: unsupported relocation type

>How-To-Repeat:
With -fPIC, it will reference the variable with:
        lwz 0,.LCL0-.LCF0(30)

However, the label ".LCL0" does not exist in the assembler output. 
Using a gcc 2.95.2 on Linux/PPC, will add these two lines:
.LCL0:
        .long .LCTOC1-.LCF0

which the output from gcc under NetBSD/PPC does not include.

When compiling with -fpic, or no extra option, the variable is 
referred to simply by the label with its name, and not a relative
address.
>Fix:
As I've understood, -fPIC is not necessary to use on powerpc (rs6000), 
but some makefiles do (gcc included, for libgcc2), and some files
don't compile. 
>Release-Note:
>Audit-Trail:
>Unformatted:
 
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="pic.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="pic.c"

aW50IHRqbygpCnsKICBzdGF0aWMgaW50IGEgPSAwOwogIHJldHVybiBhOwp9Cg==


             reply	other threads:[~2001-08-27  6:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-27  6:56 tomas [this message]
2002-04-26  0:03 rth

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=20010827135226.17192.qmail@sourceware.cygnus.com \
    --to=tomas@nocrew.org \
    --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).