public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: "Russ.Shaw" <russell@webaxs.net>
To: Doug Evans <dje@transmeta.com>, crossgcc@sourceware.cygnus.com
Subject: Re: Library and linker errors
Date: Wed, 02 Aug 2000 02:27:00 -0000	[thread overview]
Message-ID: <3987EA19.B794F54B@webaxs.net> (raw)
In-Reply-To: <14727.47860.955266.603288@casey.transmeta.com>

Hi D.Evans,

I think that will probably fix it :)

The reason i'm using ld separately from gcc is because the steps
i use are:
- in the process of completing each file, i'll do several
  compiles, with options set so that i can see the assembler
  output code with C source as comments,
- then a gnu-make is done with my own makefile that compiles
  the various files if necessary with gcc, then links them
  with ld, using my own linker script. I used ld separately
  so that i could use the linker script to specify where the
  eproms are etc.

This cross-gcc is the first time i've used gcc, and i didn't
know how to adapt the output memory map to my system. If gcc
can interpret a linker script, maybe i can make some changes...

I am compiling with -mh for the H8/300H option. The problem of
having H8/300 library files in /usr/local/h8300-hms/lib was the
cause of my last heap of errors! I fixed that by copying the
files from /usr/local/h8300-hms/lib/h8300h into this directory.
I'll see if i can make h8300-hms-gcc do this in an automated
way.

Also, for ones own custom hardware, are these linker scripts
supposed to be of any use?:

/usr/local/h8300-hms/lib/ldscripts/h8300h.x
                                   h8300h.xbn
                                   h8300h.xn
                                   h8300h.xr
                                   h8300h.xu
cheers...

Doug Evans wrote:
> 
> Put -lgcc at the _end_, as in -liberty -lg -lc -lm -lgcc.
> 
> Remember that libraries are used to resolve undefined symbols
> where they appear on the command line.  If a later library
> depends on the symbols of an earlier library, you will not get them,
> and that is what you are seeing here (-lg needs something in -lgcc,
> but -lgcc appears too soon on the command line).
> 
> Actually, even that may not be sufficient (depending on the target).
> GCC, when it does the link, puts -lgcc -lc -lgcc at the end.
> This catches the case where libgcc references something in libc.
> 
> Why use ld to link at all?  Why not use gcc?
> [One case where people get into particular trouble is if
> they're using multilib'd libraries.  That can happen for the h8/300h,
> I think (it's been awhile).  It may be the case that the default is
> the h8/300, and you compile with -mh.  If that's the case then you
> do NOT want the libraries in /usr/local/h8300-hms/lib, but rather
> the ones in /usr/local/h8300-hms/lib/h8300h [or some such].
> Ergo ---> just use gcc to link and let it worry about it.
> 
> [Of course, I could be all wet here with regards to your particular
> situation.  Question:  Does /usr/local/h8300-hms/lib/h8300h exist
> on your system?]
> 
> Russ.Shaw writes:
>  > However, i get lots of linker errors like:
>  >
>  > /usr/local/h8300-hms/lib/libg.a(strtol.o)(.text+0xfa):strtol.c:
>  >                                  undefined reference to '__umodsi3'
>  > /usr/local/h8300-hms/lib/libg.a(strtol.o)(.text+0x10a):strtol.c:
>  >                                  undefined reference to '__udivsi3'
>  > /usr/local/h8300-hms/lib/libg.a(strtol.o)(.text+0x152):strtol.c:
>  >                                  undefined reference to '__umulsi3'
>  >
>  > I can't find where __umodsi3 etc are defined. In my makefile, i'm
>  > linking ld using -lgcc -liberty -lg -lc -lm.


-- 
*******************************************
*   Russell Shaw, B.Eng, M.Eng(Research)  *
*      email: russell@webaxs.net          *
*      Australia                          *
*******************************************

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

  reply	other threads:[~2000-08-02  2:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-26  6:28 error in building arm-elf gcc Jun Wu
2000-07-26 18:24 ` Joel Sherrill
2000-07-31 21:30 ` How to link in <string.h> object file? Russ.Shaw
2000-08-01 11:19 ` error in building arm-elf gcc Joel Sherrill
2000-08-01 22:49 ` Library and linker errors Russ.Shaw
2000-08-01 23:10   ` Doug Evans
2000-08-02  2:27     ` Russ.Shaw [this message]
2000-08-02  9:57       ` Doug Evans
2000-08-02  4:32   ` gcc, crt0, and linker scripts Russ.Shaw
2000-08-02  6:08     ` Russ.Shaw
2000-08-02 10:04     ` Doug Evans
2000-08-02 16:51       ` Russ.Shaw

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=3987EA19.B794F54B@webaxs.net \
    --to=russell@webaxs.net \
    --cc=crossgcc@sourceware.cygnus.com \
    --cc=dje@transmeta.com \
    /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).