Landing: 701c41191413

Project / Subsystem

gcc / avr

Date

2026-05-14

Author

Georg-Johann Lay

Commit

701c41191413fdcfeea33b8f49cfebf62b8a6135

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
avr
patch_id
commit_hash
701c41191413fdcfeea33b8f49cfebf62b8a6135
source_type
github
headline
AVR: Make -mno-call-main work with -flto.
tldr
The -mno-call-main option now works correctly with -flto by using --defsym to avoid multiple definitions of __call_main.
author
Georg-Johann Lay
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • avr
  • lto
  • linker
  • optimization
discussion_id_link
bugzilla_pr
date
2026-05-14T00:00:00.000Z

The -mno-call-main option, which prevents the AVR toolchain from automatically calling the main function, was not working correctly with link-time optimization (LTO). This commit fixes the issue by using --defsym __call_main=0 in the linker spec, which avoids multiple definitions of the __call_main symbol when linking with LTO.