public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/4136: wrong assembler for static variables with -fPIC on powerpc-elf-netbsd
@ 2002-04-26  0:03 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-04-26  0:03 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, tomas

Synopsis: wrong assembler for static variables with -fPIC on powerpc-elf-netbsd

State-Changed-From-To: open->feedback
State-Changed-By: rth
State-Changed-When: Fri Apr 26 00:03:41 2002
State-Changed-Why:
    Appears to be working in gcc 3.1 20020425.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4136


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c/4136: wrong assembler for static variables with -fPIC on powerpc-elf-netbsd
@ 2001-08-27  6:56 tomas
  0 siblings, 0 replies; 2+ messages in thread
From: tomas @ 2001-08-27  6:56 UTC (permalink / raw)
  To: gcc-gnats

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-26  7:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26  0:03 c/4136: wrong assembler for static variables with -fPIC on powerpc-elf-netbsd rth
  -- strict thread matches above, loose matches on Subject: below --
2001-08-27  6:56 tomas

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