From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4447 invoked by alias); 27 Mar 2017 08:37:44 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 4424 invoked by uid 89); 27 Mar 2017 08:37:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=simulator, H*Ad:D*huawei.com, HTo:D*huawei.com, H*i:sk:F2AD730 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Mar 2017 08:37:41 +0000 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 0CB19E54CF105; Mon, 27 Mar 2017 09:37:38 +0100 (IST) Received: from HHMAIL01.hh.imgtec.org ([fe80::710b:f219:72bc:e0b3]) by hhmail02.hh.imgtec.org ([fe80::5400:d33e:81a4:f775%25]) with mapi id 14.03.0294.000; Mon, 27 Mar 2017 09:37:40 +0100 From: Matthew Fortune To: "Zhangwen (Esan)" , "newlib@sourceware.org" Subject: RE: newlib-2.2.0/libgloss/mips/crt0.S:161: undefined reference to `hardware_hazard_hook' Date: Mon, 27 Mar 2017 08:37:00 -0000 Message-ID: <6D39441BF12EF246A7ABCE6654B0235380BDB775@HHMAIL01.hh.imgtec.org> References: In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00226.txt.bz2 Zhangwen (Esan) 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