Skip to content

[BUG] SAMv7 LTO build fails #17443

@pkarashchenko

Description

@pkarashchenko

Description / Steps to reproduce the issue

Try to build same70-xplained:mcuboot-loader config with LTO enabled with arm-none-eabi-gcc (GCC) 15.2.0 and get next build/link error:

LD: nuttx
/usr/local/opt/arm-none-eabi-binutils/bin/arm-none-eabi-ld: sam_start.o (symbol from plugin): in function `__start':
(.text+0x0): multiple definition of `__start'; crt0.o (symbol from plugin):(.text+0x0): first defined here
lto-wrapper: warning: Extra option to '-Xassembler': -mthumb, dropping all '-Xassembler' and '-Wa' options.
chip/sam_start.c:153:6: warning: type of '__start' does not match original declaration [-Wlto-type-mismatch]
  153 | void __start(void)
      |      ^
common/crt0.c:163:6: note: type mismatch in parameter 1
  163 | void __start(int argc, char *argv[])
      |      ^
common/crt0.c:163:6: note: type 'int' should match type 'void'
common/crt0.c:163:6: note: '__start' was previously declared here
/usr/local/opt/arm-none-eabi-binutils/bin/arm-none-eabi-ld: /var/folders/6l/6br4bshn12x2s8hjfqsqjt5c0000gn/T//ccQe8Sts.ltrans0.ltrans.o: in function `__assert.constprop.0':
<artificial>:(.text.__assert.constprop.0+0x284): undefined reference to `memset'
/usr/local/opt/arm-none-eabi-binutils/bin/arm-none-eabi-ld: (memset): Unknown destination type (ARM/Thumb) in /var/folders/6l/6br4bshn12x2s8hjfqsqjt5c0000gn/T//ccQe8Sts.ltrans0.ltrans.o
<artificial>:(.text.__assert.constprop.0+0x284): dangerous relocation: unsupported relocation
/usr/local/opt/arm-none-eabi-binutils/bin/arm-none-eabi-ld: /var/folders/6l/6br4bshn12x2s8hjfqsqjt5c0000gn/T//ccQe8Sts.ltrans0.ltrans.o: in function `__start':
<artificial>:(.text.__start+0x1c): undefined reference to `main'
Memory region         Used Size  Region Size  %age Used
arch/arm/samv7: optimize MCUboot loader configuration
           flash:        7560 B       144 KB      5.13%
            sram:        2560 B       384 KB      0.65%
collect2: error: ld returned 1 exit status
make[1]: *** [nuttx] Error 1
make: *** [nuttx] Error 2

On which OS does this issue occur?

[OS: Mac]

What is the version of your OS?

MACOS 15.6.1

NuttX Version

master

Issue Architecture

[Arch: arm]

Issue Area

[Area: Build System], [Area: Board support]

Host information

No response

Verification

  • I have verified before submitting the report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arch: armIssues related to ARM (32-bit) architectureArea: Board supportBoard support issuesArea: Build systemOS: MacIssues related to MacOS (building system, etc)Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions