undefined reference to _fini

Bug #1680293 reported by lzyr
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Invalid
Undecided
Unassigned

Bug Description

hi :

in the gcc-arm-none-eabi-6-2017-q1-update-win32 ver

gcc-arm-none-eabi-6-2017-q1-update-win32/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m\libc.a(lib_a-fini.o): In function `__libc_fini_array':
fini.c:(.text.__libc_fini_array+0x26): undefined reference to `_fini'
collect2.exe: error: ld returned 1 exit status

but in gcc-arm-none-eabi-6_2-2016q4-20161216-win32 is ok

thanks

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

What's your command-line?

Eldar Khayrullin (eldar)
Changed in gcc-arm-embedded:
status: New → Incomplete
Revision history for this message
lzyr (lzyr163) wrote :

arm-none-eabi-gcc.exe -mcpu=cortex-m3 -ffunction-sections -fdata-sections -fno-exceptions -DSTM32F10X_HD -DUSE_STDPERIPH_DRIVER -D__ASSEMBLY__ -DSTM32F103VC -mthumb -Os

arm-none-eabi-g++.exe -s -Wl,-Map -Wl,--gc-sections -n -Wl,-cref -mcpu=cortex-m3 -mthumb -Xlinker --gc-sections -nostartfiles -Wl,-Map,link.map --specs=nano.specs -TSrc/BSP/Start/Flash.ld

Revision history for this message
lzyr (lzyr163) wrote :

when use --specs=nano.specs link is ok

dont use --specs=nano.specs link is fini.c:(.text.__libc_fini_array+0x26): undefined reference to `_fini'
collect2.exe: error: ld returned 1 exit status

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

Hi lzyr,

Why would you not want to use the specs file? The specs file is necessary to tell the linker what library(s) and startup file(s) to link in what order.

Thanks,
Tejas.

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

Hi lzyr,

Have you tried using -specs=nosys.specs?

Best regards.

Revision history for this message
lzyr (lzyr163) wrote :
Download full text (14.5 KiB)

yes use --specs=nano.specs too be make bin small.

only use -specs=nosys.specs ,it link can pass.

use -specs=nosys.specs failed.

but at 2016q4 is ok。

link lib:

/DISCARD/ :
    {
        libc.a ( * )
        libm.a ( * )
        libgcc.a ( * )
        libnosys.a(*)
    }

startup.s
/************************************************************************************
 * File: startup.S
 * Purpose: Startup file for Cortex-M3 devices.
 * Should use with GCC for ARM Embedded Processors
 * Version: V1.4
 * Date: 09 July 2012
 * Notice: Changed for use with emIDE project wizard
 * Date: 05 July 2013
 *
 * Copyright (c) 2011, 2012, ARM Limited
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * * Neither the name of the ARM Limited nor the
 * names of its contributors may be used to endorse or promote products
 * derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ************************************************************************************/
    .syntax unified
    .arch armv7-m

/************************************************************************************
 *
 * The minimal vector table for Cortex-M3.
 * Device specific external interrupts can be added below.
 ************************************************************************************/
    .section .isr_vector
    .align 2
    .globl __isr_vector
__isr_vector:
    .long __stack_end__ /* Top of Stack */
     .long Reset_Handler /* Reset Handler */
    .long NMI_Handler /* NMI Handler */
    .long HardFault_Handler /* Hard Fault Handler */
    .long MemManage_Handler /* MPU Fault Handler */
    .long BusFault_Handler /* Bus Fault Handler */
    .long UsageFault_Handler /* Usage Fault Handler */
    .long 0 /* Reserved */
    .long 0 /* Reserved */
    .long 0 /* Re...

Revision history for this message
lzyr (lzyr163) wrote :

thank
Best regards.

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

Hi lzyr, can you please let us know if we've answered your question? If so, can we close this?

Revision history for this message
lzyr (lzyr163) wrote :

Hi lzyr, can you please let us know if we've answered your question? If so, can we close this?

ok thanks
Best regards.

Changed in gcc-arm-embedded:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.