public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld problems
@ 2003-08-07 12:34 Hylla, Kai
  2003-08-07 13:15 ` Alan Modra
  2003-08-07 13:36 ` Nick Clifton
  0 siblings, 2 replies; 6+ messages in thread
From: Hylla, Kai @ 2003-08-07 12:34 UTC (permalink / raw)
  To: binutils

Hi together!

At first I must say, that my English isn't very good, so please be
patient with me.

I'm developing software on a win32 Host for a ppc-elf embedded target. I
use 

gcc 2.95.2
as  2.10
ld  2.10


I have a problem with the ld. It seems that the ld doesn't relocate the
addresses correct. If I try to branch absolut (using ba) to an address
between 0x0200_0000 and 0xFE00_0000 it calculates the wrong value. The
calcultated value is 0xFE00_000 to high. If I try to use the correct
value as an constant (i.e. ba 0x02400238) I get an error:

     Error: operand out of range (37757824 not between -33554432 and
33554431)


Has anyone an idea what causes this problem and how to solve it?

Regards,
Kai


---
K. Hylla
Abt. NJT T3

STN ATLAS Elektronik GmbH
Sebaldsbruecker Heerstr. 235
D-28305 Bremen

Tel.: +49 421 457-3231
Fax : +49 421 457-1702 

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

* Re: ld problems
  2003-08-07 12:34 ld problems Hylla, Kai
@ 2003-08-07 13:15 ` Alan Modra
  2003-08-07 13:36 ` Nick Clifton
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Modra @ 2003-08-07 13:15 UTC (permalink / raw)
  To: Hylla, Kai; +Cc: binutils

On Thu, Aug 07, 2003 at 02:34:44PM +0200, Hylla, Kai wrote:
> I have a problem with the ld. It seems that the ld doesn't relocate the
> addresses correct. If I try to branch absolut (using ba) to an address
> between 0x0200_0000 and 0xFE00_0000 it calculates the wrong value. The
> calcultated value is 0xFE00_000 to high. If I try to use the correct
> value as an constant (i.e. ba 0x02400238) I get an error:
> 
>      Error: operand out of range (37757824 not between -33554432 and
> 33554431)

Well, it _is_ out of range.  ba can only reach addresses in the range
0xfe000000 to 0x01fffffc.  Check your hardware manual.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: ld problems
  2003-08-07 12:34 ld problems Hylla, Kai
  2003-08-07 13:15 ` Alan Modra
@ 2003-08-07 13:36 ` Nick Clifton
  1 sibling, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2003-08-07 13:36 UTC (permalink / raw)
  To: Hylla, Kai; +Cc: binutils

Hi Kai,

> ld  2.10

This is a *very* old version of ld.  Please upgrade to the latest
release (2.14) and try again.

Cheers
        Nick
        

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

* Re: ld problems
  2004-09-13  0:24 ` Alan Modra
@ 2004-09-13  9:26   ` Mattias Jansson
  0 siblings, 0 replies; 6+ messages in thread
From: Mattias Jansson @ 2004-09-13  9:26 UTC (permalink / raw)
  To: binutils

On Mon, 2004-09-13 at 02:24, Alan Modra wrote:
> On Sat, Sep 11, 2004 at 04:30:15PM +0200, Mattias Jansson wrote:
> > typeinfo for neo::scene::Object: discarded in section
> > `.gnu.linkonce.r._ZTIN3neo5scene6ObjectE' from
> > build/scons/debug/engine/libneoengine-debug.a(object.o)
> > collect2: ld returned 1 exit status
> 
> You didn't say the target or the version of ld where you found this
> problem which makes it harder to give an answer because we have to
> guess these details.  I'll guess x86 and 2.15 or one of HJ's 2.15.x
> releases.  You also didn't give the version of gcc.

Sorry

$ uname -m
x86_64

$ ld --version
GNU ld version 2.15.90.0.1.1 20040303

$ gcc --version
gcc (GCC) 3.4.1 20040803 (Gentoo Linux 3.4.1-r2, ssp-3.4-2, pie-8.7.6.5)

> I expect that if someone analysed this problem properly, you would find
> a reference to the typeinfo symbol in a normal section such as .data or
> .rodata.  What's more, I'll make a wild guess that the reference is made
> inside some function that requires linkonce semantics itself, and most
> of the function is defined in sections named .gnu.linkonce.*.  If that's
> the case then this is really a g++ code generation error.

You're right, I saw that gcc 3.4.2 is now available in the gentoo tree
and after an update to this the problem went away. Thanks for the help!
(and sorry for the lack of proper information in my first post)
 
/ Mattias


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

* Re: ld problems
  2004-09-11 14:43 Mattias Jansson
@ 2004-09-13  0:24 ` Alan Modra
  2004-09-13  9:26   ` Mattias Jansson
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2004-09-13  0:24 UTC (permalink / raw)
  To: Mattias Jansson; +Cc: binutils

On Sat, Sep 11, 2004 at 04:30:15PM +0200, Mattias Jansson wrote:
> typeinfo for neo::scene::Object: discarded in section
> `.gnu.linkonce.r._ZTIN3neo5scene6ObjectE' from
> build/scons/debug/engine/libneoengine-debug.a(object.o)
> collect2: ld returned 1 exit status

You didn't say the target or the version of ld where you found this
problem which makes it harder to give an answer because we have to
guess these details.  I'll guess x86 and 2.15 or one of HJ's 2.15.x
releases.  You also didn't give the version of gcc.

I expect that if someone analysed this problem properly, you would find
a reference to the typeinfo symbol in a normal section such as .data or
.rodata.  What's more, I'll make a wild guess that the reference is made
inside some function that requires linkonce semantics itself, and most
of the function is defined in sections named .gnu.linkonce.*.  If that's
the case then this is really a g++ code generation error.

However, ld ought to be forgiving in this situation, so this error is
also a ld bug.  I fixed the ld bug on 2004-08-13 for CVS head, so you
might like to try compiling current CVS binutils.  You'll get a warning
instead of an error.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* ld problems
@ 2004-09-11 14:43 Mattias Jansson
  2004-09-13  0:24 ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Mattias Jansson @ 2004-09-11 14:43 UTC (permalink / raw)
  To: binutils


Please excuse me if this is the wrong place for this kind of questions,
but I've been banging my head against this particular wall for a while
now, and don't think I'll find a solution on my own.

I am linking a a program consisting of a single C++ object file (a test
suite) with a rather large static library also written in C++ (my 3D
game engine). Everything has worked fine for quite some time, but
recently I started getting an annoying error during the link phase of
the program (compiling the static library archive itself is just fine,
no problems there). The error I'm getting is

g++ -o build/scons/debug/test/test-font-debug
build/scons/debug/test/font/application.o -Lbuild/scons/debug/engine
-Lsrc -L/usr/X11R6/lib -lneoapplication-debug -lneoengine-debug -lGL
-lXxf86vm -lX11
typeinfo for neo::scene::Object: discarded in section
`.gnu.linkonce.r._ZTIN3neo5scene6ObjectE' from
build/scons/debug/engine/libneoengine-debug.a(object.o)
collect2: ld returned 1 exit status

where 'libneoengine-debug.a' is the engine static library archive.

I have searched for a better description of the problem and what to do
about it, but can't seem to find anything. 

The problem goes away if I rename the neo::scene::Object class to
something else, but that's not a solution. 

It also goes away if I add a --whole-archive / --no-whole-archive block
around -lneoengine-debug, but that sounds like a hack rather than a
solution to me.

Does anybody have an idea of what the problem might be and how to fix
it? Or simply describe this error in more detail to point me in the
right direction? If you need more information or the source, just tell
me.

Thanks!

/ Mattias


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

end of thread, other threads:[~2004-09-13  9:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-07 12:34 ld problems Hylla, Kai
2003-08-07 13:15 ` Alan Modra
2003-08-07 13:36 ` Nick Clifton
2004-09-11 14:43 Mattias Jansson
2004-09-13  0:24 ` Alan Modra
2004-09-13  9:26   ` Mattias Jansson

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