public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* Re: sbrk undefined symbol
  2000-04-01  0:00 sbrk undefined symbol Stephane Dalton
@ 2000-04-01  0:00 ` Aaron J. Grier
  2000-04-01  0:00 ` Doug Evans
  1 sibling, 0 replies; 3+ messages in thread
From: Aaron J. Grier @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Stephane Dalton; +Cc: crossgcc

On Mon, Feb 21, 2000 at 01:58:52PM -0500, Stephane Dalton wrote:

> Today I've added a #include <assert.h> inside on of the file and now
> at link time I got these error messages:

[undefined references to abort, _exit, sbrk, kill, and getpid]

> I've encountered this kind of error before (for different type of
> function) and the FAQ simply told to stub out these. Should I do the
> same here. I'm a bit worry to see sbrk here because as far as I know
> it is used for memory allocation???

assert() as defined in newlib depends on all these functions.  You can
find stubs in libgloss.  You'll need to link these in for assert to
work.

-- 
  Aaron J. Grier   |   Frye Electronics, Tigard, OR   |   aaron@frye.com
  "The simplistic anthropomorphism which asserts that source code has a
   life separate from its creator or maintainer is the product of one
   too many viewings of Tron."  -- paraphrasing of anonymous post on /.

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

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

* sbrk undefined symbol
  2000-04-01  0:00 sbrk undefined symbol Stephane Dalton
  2000-04-01  0:00 ` Aaron J. Grier
@ 2000-04-01  0:00 ` Doug Evans
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Evans @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Stephane Dalton; +Cc: crossgcc

Stephane Dalton writes:
 > I've a simple question for you, I've successfully build a m68k-psos-elf
 > compiler and library (binutils 2.9.1, gcc-2.95.2, and newlib 1.8.2), and
 > I've been able to compile assemble and link my new bootloader for our board.
 > 
 > Today I've added a #include <assert.h> inside on of the file and now at link
 > time I got these error messages:

Loosely phrased [the details aren't important]:
assert() calls fprintf, fprintf calls malloc, malloc calls sbrk.

 > ent/sbrkr.c:61: undefined reference to `sbrk'

 > I've encountered this kind of error before (for different type of function)
 > and the FAQ simply told to stub out these. Should I do the same here. I'm a
 > bit worry to see sbrk here because as far as I know it is used for memory
 > allocation???

sbrk is a function you have to write yourself.
See for example newlib-1.8.2/libgloss/mcore/sbrk.c.

An alternative is to roll your own assert() and avoid this.

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

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

* sbrk undefined symbol
@ 2000-04-01  0:00 Stephane Dalton
  2000-04-01  0:00 ` Aaron J. Grier
  2000-04-01  0:00 ` Doug Evans
  0 siblings, 2 replies; 3+ messages in thread
From: Stephane Dalton @ 2000-04-01  0:00 UTC (permalink / raw)
  To: crossgcc

Hi everybody,

I've a simple question for you, I've successfully build a m68k-psos-elf
compiler and library (binutils 2.9.1, gcc-2.95.2, and newlib 1.8.2), and
I've been able to compile assemble and link my new bootloader for our board.

Today I've added a #include <assert.h> inside on of the file and now at link
time I got these error messages:

/usr/local/m68k-psos-elf/lib/libc.a(abort.o): In function `abort':
/usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/stdlib/../../../../../ne
wlib-1.8.2/newlib/libc/s
tdlib/abort.c:62: undefined reference to `_exit'
/usr/local/m68k-psos-elf/lib/libc.a(sbrkr.o): In function `_sbrk_r':
/usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
lib-1.8.2/newlib/libc/re
ent/sbrkr.c:61: undefined reference to `sbrk'
/usr/local/m68k-psos-elf/lib/libc.a(signalr.o): In function `_kill_r':
/usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
lib-1.8.2/newlib/libc/re
ent/signalr.c:59: undefined reference to `kill'
/usr/local/m68k-psos-elf/lib/libc.a(signalr.o): In function `_getpid_r':
/usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
lib-1.8.2/newlib/libc/re
ent/signalr.c:94: undefined reference to `getpid'
make[1]: *** [/sts1mux/BootLoader/bin/boot] Error 1
make: *** [subdirs] Error 2

I've encountered this kind of error before (for different type of function)
and the FAQ simply told to stub out these. Should I do the same here. I'm a
bit worry to see sbrk here because as far as I know it is used for memory
allocation???

I've tried with another cross compiler (m68k-elf) and I get the exact same
result..

Any hints

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

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

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01  0:00 sbrk undefined symbol Stephane Dalton
2000-04-01  0:00 ` Aaron J. Grier
2000-04-01  0:00 ` Doug Evans

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