Fix check for main function already declared

This commit is contained in:
Antoni Boucher 2024-04-19 20:55:59 -04:00
parent ab7d138d16
commit 7cd561efd6

View File

@ -526,7 +526,7 @@ fn apply_target_cpu_attr(&self, _llfn: RValue<'gcc>) {
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
let entry_name = self.sess().target.entry_name.as_ref();
if self.get_declared_value(entry_name).is_none() {
if !self.functions.borrow().contains_key(entry_name) {
Some(self.declare_entry_fn(entry_name, fn_type, ()))
} else {
// If the symbol already exists, it is an error: for example, the user wrote