This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: newlib-2.2.0/libgloss/mips/crt0.S:161: undefined reference to `hardware_hazard_hook'


Zhangwen (Esan) <zwzhangwen.zhang@huawei.com> writes:
> I found the mips compile with newlib-2.2.0 can report the error message
> when linking with crt0.o manually:
> ./install/bin/mips-sde-elf-ld: warning: cannot find entry symbol
> __start; defaulting to 00000000004000d4
> newlib-2.2.0/libgloss/mips/crt0.S:161: undefined reference to
> `hardware_hazard_hook'
> newlib-2.2.0/libgloss/mips/crt0.S:161: undefined reference to
> `hardware_hazard_hook'
> newlib-2.2.0/libgloss/mips/crt0.S:195: undefined reference to
> `get_mem_info'
> newlib-2.2.0/libgloss/mips/crt0.S:198: undefined reference to `__stack'
> newlib-2.2.0/libgloss/mips/crt0.S:198: undefined reference to `__stack'
> newlib-2.2.0/libgloss/mips/crt0.S:227: undefined reference to
> `hardware_init_hook'
> newlib-2.2.0/libgloss/mips/crt0.S:227: undefined reference to
> `hardware_init_hook'
> newlib-2.2.0/libgloss/mips/crt0.S:231: undefined reference to
> `software_init_hook'
> newlib-2.2.0/libgloss/mips/crt0.S:231: undefined reference to
> `software_init_hook'
> newlib-2.2.0/libgloss/mips/crt0.S:301: undefined reference to
> `hardware_exit_hook'
> newlib-2.2.0/libgloss/mips/crt0.S:301: undefined reference to
> `hardware_exit_hook'
> Coud you know the reason for the error and the solution? I have no
> change for newlib source code.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]