* [OpenRISC] newlib, malloc missing, I must be missing something
@ 2016-08-25 14:01 Dan
2016-08-25 14:39 ` Stefan Wallentowitz
2016-08-25 15:23 ` Jeremy Bennett
0 siblings, 2 replies; 3+ messages in thread
From: Dan @ 2016-08-25 14:01 UTC (permalink / raw)
To: openrisc
Hello!
I just built the or1k tool suite according to the directions on
openrisk.io/newlib/building.html. However, when trying to build my
first file, I'm getting:
% or1k-elf-gcc -O3 -o dhry.o -c dhry.c
% or1k-elf-ld -o dhry dhry.o
% or1k-elf-ld: warning: cannot find entry symbol _start; defaulting to
0000000000000000
dhry.o: In function `Func_2':
dhry.c:(.text+0x444): undefined reference to `strcmp'
dhry.o: In function `main':
dhry.c:(.text.startup+0x34): undefined reference to `malloc'
dhry.c:(.text.startup+0x48): undefined reference to `malloc'
dhry.c:(.text.startup+0x1e8): undefined reference to `strcmp'
dhry.c:(.text.startup+0x390): undefined reference to `exit'
However, if I just do the linking with GCC alone, I get:
% or1k-elf-gcc dhry.o -o dhry
% (No errors)
Any thoughts?
Thanks!
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20160825/68ef21c5/attachment.html>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [OpenRISC] newlib, malloc missing, I must be missing something
2016-08-25 14:01 [OpenRISC] newlib, malloc missing, I must be missing something Dan
@ 2016-08-25 14:39 ` Stefan Wallentowitz
2016-08-25 15:23 ` Jeremy Bennett
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Wallentowitz @ 2016-08-25 14:39 UTC (permalink / raw)
To: openrisc
On 25.08.2016 16:01, Dan wrote:
> Hello!
>
> I just built the or1k tool suite according to the directions on
> openrisk.io/newlib/building.html. However, when trying to build my
> first file, I'm getting:
>
>
> % or1k-elf-gcc -O3 -o dhry.o -c dhry.c
> % or1k-elf-ld -o dhry dhry.o
> % or1k-elf-ld: warning: cannot find entry symbol _start; defaulting to
Hi,
can you try:
or1k-elf-gcc -o dhry dhry.o
Cheers,
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20160825/4f9a9f23/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [OpenRISC] newlib, malloc missing, I must be missing something
2016-08-25 14:01 [OpenRISC] newlib, malloc missing, I must be missing something Dan
2016-08-25 14:39 ` Stefan Wallentowitz
@ 2016-08-25 15:23 ` Jeremy Bennett
1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Bennett @ 2016-08-25 15:23 UTC (permalink / raw)
To: openrisc
On 25/08/16 16:01, Dan wrote:
> Hello!
>
> I just built the or1k tool suite according to the directions on
> openrisk.io/newlib/building.html. However, when trying to build my
> first file, I'm getting:
>
>
> % or1k-elf-gcc -O3 -o dhry.o -c dhry.c
> % or1k-elf-ld -o dhry dhry.o
> % or1k-elf-ld: warning: cannot find entry symbol _start; defaulting to
> 0000000000000000
> dhry.o: In function `Func_2':
> dhry.c:(.text+0x444): undefined reference to `strcmp'
> dhry.o: In function `main':
> dhry.c:(.text.startup+0x34): undefined reference to `malloc'
> dhry.c:(.text.startup+0x48): undefined reference to `malloc'
> dhry.c:(.text.startup+0x1e8): undefined reference to `strcmp'
> dhry.c:(.text.startup+0x390): undefined reference to `exit'
>
> However, if I just do the linking with GCC alone, I get:
>
> % or1k-elf-gcc dhry.o -o dhry
> % (No errors)
>
> Any thoughts?
Hi Dan,
The C compiler is a driver for the linker, putting in all the libraries
you need. You should always link C code using gcc, not ld.
To see the link line used try gcc -v. It will show you all the
sub-commands used.
Jeremy
>
> Thanks!
>
> Dan
>
>
> _______________________________________________
> OpenRISC mailing list
> OpenRISC at lists.librecores.org
> https://lists.librecores.org/listinfo/openrisc
>
--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Twitter: @jeremypbennett
Email: jeremy.bennett at embecosm.com
Web: www.embecosm.com
PGP key: 1024D/BEF58172FB4754E1 2009-03-20
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20160825/d355cc76/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-25 15:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25 14:01 [OpenRISC] newlib, malloc missing, I must be missing something Dan
2016-08-25 14:39 ` Stefan Wallentowitz
2016-08-25 15:23 ` Jeremy Bennett
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.