bool avr_need_copy_data_p = false;
bool avr_has_rodata_p = false;
-/* To track if we satisfy __call_main from AVR-LibC. */
-bool avr_no_call_main_p = false;
-
/* Counts how often pass avr-fuse-add has been executed. Is is kept in
sync with cfun->machine->n_avr_fuse_add_executed and serves as an
insn condition for shift insn splitters. */
*attributes = tree_cons (get_identifier ("section"),
arg, *attributes);
}
- avr_no_call_main_p = true;
+ if (!lookup_attribute ("used", *attributes))
+ *attributes = tree_cons (get_identifier ("used"),
+ NULL_TREE, *attributes);
}
} // -mno-call-main
#endif // AVR-LibC
if (avr_need_clear_bss_p)
fputs (".global __do_clear_bss\n", asm_out_file);
-
- /* Don't let __call_main call main() and exit().
- Defining this symbol will keep the code from being pulled
- in from lib<mcu>.a as requested by AVR-LibC's gcrt1.S.
- We invoke main() by other means: putting it in .init9. */
-
- if (avr_no_call_main_p)
- fputs (".global __call_main\n"
- "__call_main = 0\n", asm_out_file);
}
fprintf (f, "*link_relax:\n\t%s\n\n", LINK_RELAX_SPEC);
+ fprintf (f, "*link_no_call_main:\n\t%s\n\n", "%{mno-call-main: --defsym __call_main=0}");
+
fprintf (f, "*link_arch:\n\t%s", link_arch_spec);
if (mi.is_device
&& rodata_pm_offset)