summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/context.rs
diff options
context:
space:
mode:
authorAyush Singh <ayushsingh1325@gmail.com>2022-11-15 22:15:55 +0530
committerAyush Singh <ayushsingh1325@gmail.com>2022-11-15 22:15:55 +0530
commit6dfe2395c9f26076e339ea40c269f4b23f8c22c8 (patch)
treeec138b97feb8d4adf288058fef496a1b2f4d9e0e /compiler/rustc_codegen_gcc/src/context.rs
parent9f0a8620bd7d325e6d42417b08daff3e55cb88f6 (diff)
downloadrust-6dfe2395c9f26076e339ea40c269f4b23f8c22c8.tar.gz
rust-6dfe2395c9f26076e339ea40c269f4b23f8c22c8.zip
Use custom entry name in gcc
This is a continuation of 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 for
gcc.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/context.rs')
-rw-r--r--compiler/rustc_codegen_gcc/src/context.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_gcc/src/context.rs b/compiler/rustc_codegen_gcc/src/context.rs
index 62a61eb8548..2e71c3665da 100644
--- a/compiler/rustc_codegen_gcc/src/context.rs
+++ b/compiler/rustc_codegen_gcc/src/context.rs
@@ -425,8 +425,9 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
     }
 
     fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
-        if self.get_declared_value("main").is_none() {
-            Some(self.declare_cfn("main", fn_type))
+        let entry_name = self.sess().target.entry_name.as_ref();
+        if self.get_declared_value(entry_name).is_none() {
+            Some(self.declare_entry_fn(entry_name, fn_type, ()))
         }
         else {
             // If the symbol already exists, it is an error: for example, the user wrote