public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: "Zhangwen (Esan)" <zwzhangwen.zhang@huawei.com>
To: Matthew Fortune <Matthew.Fortune@imgtec.com>,
	       "newlib@sourceware.org"	<newlib@sourceware.org>
Subject: 答复: newlib-2.2.0/libgloss/mips/crt0.S:161: undefined reference to `hardware_hazard_hook'
Date: Mon, 27 Mar 2017 09:34:00 -0000	[thread overview]
Message-ID: <F2AD730AE2E0D74BAEE20D4C1C6D02BD61D7C74F@DGGEML504-MBS.china.huawei.com> (raw)
In-Reply-To: <6D39441BF12EF246A7ABCE6654B0235380BDB775@HHMAIL01.hh.imgtec.org>

>Hi,
>
>It looks like you have not specified any form of linker script and MIPS crt0.S in newlib only works in conjunction with a linker script as it is dependent on external symbols that are not provided by the C library or ordinary modules:
>
>1) MIPS uses _start as the entry point not __start
>2) The various init hooks are normally defined weak via the linker
>  script
>
>3) The stack must be defined somewhere using the __stack symbol
>   which is normally set to a valid address via the linker script.
>
>See mti32.ld as an example linker script although I doubt it will be suitable for your environment as it is designed around an older boot monitor. Mti32.ld will however create you an executable that you can run using the GNUSIM simulator provided with GDB.
>
>Hope that helps.
>
>Thanks,
>Matthew
It's a great help for me and thanks very much. After I rewrote a new linker script and add the definition of most symbols, there was only one symbol undefined:
newlib-2.2.0/libgloss/mips/crt0.S:195: undefined reference to `get_mem_info'
I found it in the source code:
libgloss/mips/jmr3904-io.c:100:get_mem_info (mem)
libgloss/mips/dvemon.c:79:get_mem_info (mem)
libgloss/mips/cfe_mem.c:126:get_mem_info (struct s_mem *meminfo)
libgloss/mips/cygmon.c:78:get_mem_info (mem)
Then I search the .c files in building log, but no the corresponding files. Maybe .c files can not be compiled in building newlib, so the symbol " get_mem_info " is undefined when linking.
But I have two problems:
1) How can .c file with the definition " get_mem_info " be compiled?
2) How can crt0.o file be linked default when excuting mips-*-ld? Now I need to add the crt0.o manually.
I have no experience on mips compile, so the low problems are more than others.

Cheers,
Zhangwen

  reply	other threads:[~2017-03-27  9:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  7:12 Zhangwen (Esan)
2017-03-27  8:37 ` Matthew Fortune
2017-03-27  9:34   ` Zhangwen (Esan) [this message]
2017-03-27 12:47     ` Matthew Fortune
2017-03-28  2:17       ` 答复: " Zhangwen (Esan)

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=F2AD730AE2E0D74BAEE20D4C1C6D02BD61D7C74F@DGGEML504-MBS.china.huawei.com \
    --to=zwzhangwen.zhang@huawei.com \
    --cc=Matthew.Fortune@imgtec.com \
    --cc=newlib@sourceware.org \
    /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).