public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Library and linker errors
       [not found] <965190972.29952.ezmlm@gcc.gnu.org>
@ 2000-08-01 21:46 ` Russ.Shaw
  2000-08-02  4:34   ` gcc, crt0, and linker scripts Russ.Shaw
  2000-08-02 16:33   ` Library and linker errors Alexandre Oliva
  0 siblings, 2 replies; 6+ messages in thread
From: Russ.Shaw @ 2000-08-01 21:46 UTC (permalink / raw)
  To: gcc-help

Hi all,

I'm using gcc-2.95.5 configured as a cross-compiler for the
hitachi H8/300H cpu core. I'm using mandrake-7.0.

I found that h8300-hms-gcc gets its library files from:

/usr/local/h8300-hms/lib/libc.a
                         libg.a
                         libm.a
                         libiberty.a
and

/usr/local/lib/h8300-hms/libgcc.a (iirc)


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

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

* gcc, crt0, and linker scripts...
  2000-08-01 21:46 ` Library and linker errors Russ.Shaw
@ 2000-08-02  4:34   ` Russ.Shaw
  2000-08-02 16:33   ` Library and linker errors Alexandre Oliva
  1 sibling, 0 replies; 6+ messages in thread
From: Russ.Shaw @ 2000-08-02  4:34 UTC (permalink / raw)
  To: gcc-help

Hi all,

I'm using gcc-2.95.5 configured as a cross-compiler for the
hitachi H8/300H cpu core. I'm using mandrake-7.0.

I want to use h8300-hms-gcc to generate code for my own system.

However, what does gcc use for a linker script? I need to tell
gcc about my eprom memory map etc.

I could get gcc to use my own script using -Wl,T<myscript>, but
i'll still get linker errors because the output section names
need to be compatible with the supplied crt0 start-up file.

I can't use my own startup file, because the standard C libraries
refer to symbols such as _end in crt0.o.

So what is the 'normal' procedure for configuring a cross-gcc to
custom hardware? Also, in my install, i have these linker scripts:

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

I don't know if gcc knows about these or not.

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

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

* Re: Library and linker errors
  2000-08-01 21:46 ` Library and linker errors Russ.Shaw
  2000-08-02  4:34   ` gcc, crt0, and linker scripts Russ.Shaw
@ 2000-08-02 16:33   ` Alexandre Oliva
  2000-08-02 17:02     ` Russ.Shaw
  1 sibling, 1 reply; 6+ messages in thread
From: Alexandre Oliva @ 2000-08-02 16:33 UTC (permalink / raw)
  To: Russ.Shaw; +Cc: gcc-help

On Aug  2, 2000, "Russ.Shaw" <russell@webaxs.net> wrote:

> I can't find where __umodsi3 etc are defined. In my makefile, i'm
> linking ld using -lgcc -liberty -lg -lc -lm.

You've got the order of libraries all wrong.  The order is important
because the linker only scans each library once.  Besides, I have the
impression that libg.a is just libc.a with debugging symbols.

Move -lm before -lc, then put -lgcc before *and* after -lc.

When in doubt, use gcc for linking, since it already does the right
thing regarding -lc and -lgcc.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Library and linker errors
  2000-08-02 16:33   ` Library and linker errors Alexandre Oliva
@ 2000-08-02 17:02     ` Russ.Shaw
  2000-08-07 23:36       ` Connecting stdin and stdout to serial port Russ.Shaw
  0 siblings, 1 reply; 6+ messages in thread
From: Russ.Shaw @ 2000-08-02 17:02 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-help

Hi,

My last reply i sent last night bounced after 5 hours.

I got it all to compile and link now :)

The last error i was getting was that the _end symbol in some
C libraries remained undefined. I found that this was defined
in the supplied linker scripts:

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

So i added _end to my own script, and voila, no errors :)

I also found a gcc option for passing linker commands: -Wl,<linker opts>
which might be a way of telling it to use my own linker script.


Alexandre Oliva wrote:
> 
> On Aug  2, 2000, "Russ.Shaw" <russell@webaxs.net> wrote:
> 
> > I can't find where __umodsi3 etc are defined. In my makefile, i'm
> > linking ld using -lgcc -liberty -lg -lc -lm.
> 
> You've got the order of libraries all wrong.  The order is important
> because the linker only scans each library once.  Besides, I have the
> impression that libg.a is just libc.a with debugging symbols.
> 
> Move -lm before -lc, then put -lgcc before *and* after -lc.
> 
> When in doubt, use gcc for linking, since it already does the right
> thing regarding -lc and -lgcc.
> 
> --
> Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
> Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
> CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
> Free Software Evangelist    *Please* write to mailing lists, not to me

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

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

* Connecting stdin and stdout to serial port...
  2000-08-02 17:02     ` Russ.Shaw
@ 2000-08-07 23:36       ` Russ.Shaw
  2000-08-08 18:18         ` Alexandre Oliva
  0 siblings, 1 reply; 6+ messages in thread
From: Russ.Shaw @ 2000-08-07 23:36 UTC (permalink / raw)
  To: gcc-help

Hi all,

I'm using gcc for the H8/3048, and am using the standard
C libraries.

To use scanf(), printf() etc, files need to be defined
for stdin and stdout. Somehow, these have to be connected
to the input and output of the rs232 serial port.

What's the usual way of doing this?

I currently have an array that gets filled by received
characters (interrupt driven), and an output array that
gets its contents emptied out the serial port when a
function triggers the tx interrupt. After the array
empties, the tx interrupt is disabled.

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

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

* Re: Connecting stdin and stdout to serial port...
  2000-08-07 23:36       ` Connecting stdin and stdout to serial port Russ.Shaw
@ 2000-08-08 18:18         ` Alexandre Oliva
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Oliva @ 2000-08-08 18:18 UTC (permalink / raw)
  To: Russ.Shaw; +Cc: gcc-help

On Aug  8, 2000, "Russ.Shaw" <russell@webaxs.net> wrote:

> I'm using gcc for the H8/3048, and am using the standard
> C libraries.

GCC has no standard C libraries.  In fact, your question has nothing
to do with GCC.  You should ask for help in C programming in
newsgroups or mailing-lists about C programming in general.

> To use scanf(), printf() etc, files need to be defined
> for stdin and stdout. Somehow, these have to be connected
> to the input and output of the rs232 serial port.

> What's the usual way of doing this?

freopen() or dup2()

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

end of thread, other threads:[~2000-08-08 18:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <965190972.29952.ezmlm@gcc.gnu.org>
2000-08-01 21:46 ` Library and linker errors Russ.Shaw
2000-08-02  4:34   ` gcc, crt0, and linker scripts Russ.Shaw
2000-08-02 16:33   ` Library and linker errors Alexandre Oliva
2000-08-02 17:02     ` Russ.Shaw
2000-08-07 23:36       ` Connecting stdin and stdout to serial port Russ.Shaw
2000-08-08 18:18         ` Alexandre Oliva

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