* [parisc-linux] gcc (g++) problem
@ 2002-02-26 3:53 Jeremy Drake
2002-02-26 4:25 ` John David Anglin
0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Drake @ 2002-02-26 3:53 UTC (permalink / raw)
To: parisc-linux
As you may remember from my last question, I'm having some problems
building some code on parisc-linux. I have been able to reproduce the
problem using a more simple program.
Here's the problem. This program segfaults when compiled with -fPIC, as
required to build a .so. It is fine when compiled without -fPIC. It is
also fine on intel platform with both. Is there something wrong with the
code that I'm not seeing, or is this a compiler bug? I have tried this
with gcc-3 on an intel box, and it is fine, so I assume it is this port?
Thanks for your help...
g++ -g -o test -fPIC test.cpp
---- test.cpp ----
#include <stdio.h>
class Foo
{
public:
Foo(const char * const blah);
unsigned char* text;
};
Foo::Foo(const char * const blah)
{
text=(unsigned char *)blah;
}
const Foo test("Blah");
int main()
{
printf("%s\n", test.text);
return 0;
}
--
Advertisements contain the only truths to be relied on in a newspaper.
-- Thomas Jefferson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [parisc-linux] gcc (g++) problem
2002-02-26 3:53 [parisc-linux] gcc (g++) problem Jeremy Drake
@ 2002-02-26 4:25 ` John David Anglin
2002-02-26 4:38 ` Randolph Chung
2002-02-27 0:13 ` Jeremy Drake
0 siblings, 2 replies; 5+ messages in thread
From: John David Anglin @ 2002-02-26 4:25 UTC (permalink / raw)
To: Jeremy Drake; +Cc: parisc-linux
> Here's the problem. This program segfaults when compiled with -fPIC, as
> required to build a .so. It is fine when compiled without -fPIC. It is
> also fine on intel platform with both. Is there something wrong with the
> code that I'm not seeing, or is this a compiler bug? I have tried this
> with gcc-3 on an intel box, and it is fine, so I assume it is this port?
It's probably a compiler bug. The code works ok with my 3.1 test version.
I think the problem may be the restoration of the pic offset table register
after function calls.
Suggest trying the debian 3.1 prerelease build. Search the list to find
how to get it.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [parisc-linux] gcc (g++) problem
2002-02-26 4:25 ` John David Anglin
@ 2002-02-26 4:38 ` Randolph Chung
2002-02-26 16:20 ` John David Anglin
2002-02-27 0:13 ` Jeremy Drake
1 sibling, 1 reply; 5+ messages in thread
From: Randolph Chung @ 2002-02-26 4:38 UTC (permalink / raw)
To: John David Anglin; +Cc: Jeremy Drake, parisc-linux
> It's probably a compiler bug. The code works ok with my 3.1 test version.
> I think the problem may be the restoration of the pic offset table register
> after function calls.
>
> Suggest trying the debian 3.1 prerelease build. Search the list to find
> how to get it.
something is broken in the debian 3.1 snapshot package,
unfortunately....
legolas[20:35] ~% /usr/lib/gcc-snapshot/bin/g++ -o foo foo.cc
/usr/bin/ld: unrecognized option '--eh-frame-hdr'
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
randolph
--
@..@ http://www.TauSq.org/
(----)
( >__< )
^^ ~~ ^^
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [parisc-linux] gcc (g++) problem
2002-02-26 4:38 ` Randolph Chung
@ 2002-02-26 16:20 ` John David Anglin
0 siblings, 0 replies; 5+ messages in thread
From: John David Anglin @ 2002-02-26 16:20 UTC (permalink / raw)
To: randolph; +Cc: jeremyd, parisc-linux
> > Suggest trying the debian 3.1 prerelease build. Search the list to find
> > how to get it.
>
> something is broken in the debian 3.1 snapshot package,
> unfortunately....
No, the problem is 3.1 was built with a recent version of binutils
which supports --eh-frame-hdr. This change also involved changing
the way libgcc and the shared version of libgcc were linked with
shared libraries. Do you recall your report of a build failure of
3.1 linking libstdc++? My trying to fix this problem lead to a
heated discussion on gcc-patches. My fix was reverted, then further
problems arose, and a new patch affecting the linkage of libgcc
was installed yesterday.
> legolas[20:35] ~% /usr/lib/gcc-snapshot/bin/g++ -o foo foo.cc
> /usr/bin/ld: unrecognized option '--eh-frame-hdr'
> /usr/bin/ld: use the --help option for usage information
> collect2: ld returned 1 exit status
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [parisc-linux] gcc (g++) problem
2002-02-26 4:25 ` John David Anglin
2002-02-26 4:38 ` Randolph Chung
@ 2002-02-27 0:13 ` Jeremy Drake
1 sibling, 0 replies; 5+ messages in thread
From: Jeremy Drake @ 2002-02-27 0:13 UTC (permalink / raw)
To: John David Anglin; +Cc: parisc-linux
Cool. Seems to work OK on the test, now to try it on the real thing...
On Mon, 25 Feb 2002, John David Anglin wrote:
> > Here's the problem. This program segfaults when compiled with -fPIC, as
> > required to build a .so. It is fine when compiled without -fPIC. It is
> > also fine on intel platform with both. Is there something wrong with the
> > code that I'm not seeing, or is this a compiler bug? I have tried this
> > with gcc-3 on an intel box, and it is fine, so I assume it is this port?
>
> It's probably a compiler bug. The code works ok with my 3.1 test version.
> I think the problem may be the restoration of the pic offset table register
> after function calls.
>
> Suggest trying the debian 3.1 prerelease build. Search the list to find
> how to get it.
>
> Dave
>
--
QOTD:
"It's not the despair... I can stand the despair. It's the hope."
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-02-27 0:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-26 3:53 [parisc-linux] gcc (g++) problem Jeremy Drake
2002-02-26 4:25 ` John David Anglin
2002-02-26 4:38 ` Randolph Chung
2002-02-26 16:20 ` John David Anglin
2002-02-27 0:13 ` Jeremy Drake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox