diff options
| author | bors <bors@rust-lang.org> | 2022-11-19 06:40:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-19 06:40:38 +0000 |
| commit | 2f8d8040166a730d0da7bba0f2864f0ef7ff6364 (patch) | |
| tree | b3c1cb60370e9195576083b367a68464deebf57d /compiler/rustc_codegen_gcc/src | |
| parent | becc24a23aed2639db3b78acd93ec6d553898583 (diff) | |
| parent | 3cf3a65a719e29bc5aac8a3a3be8a21f3162acf2 (diff) | |
Auto merge of #104600 - Dylan-DPC:rollup-glw1e8b, r=Dylan-DPC
Rollup of 8 pull requests
Successful merges:
- #104001 (Improve generating Custom entry function)
- #104411 (nll: correctly deal with bivariance)
- #104528 (Properly link `{Once,Lazy}{Cell,Lock}` in docs)
- #104553 (Improve accuracy of asinh and acosh)
- #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)
- #104566 (couple of clippy::perf fixes)
- #104575 (deduplicate tests)
- #104580 (diagnostics: only show one suggestion for method -> assoc fn)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_gcc/src')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/context.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/declare.rs | 4 |
2 files changed, 5 insertions, 4 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 diff --git a/compiler/rustc_codegen_gcc/src/declare.rs b/compiler/rustc_codegen_gcc/src/declare.rs index a619e2f7712..eae77508c97 100644 --- a/compiler/rustc_codegen_gcc/src/declare.rs +++ b/compiler/rustc_codegen_gcc/src/declare.rs @@ -65,13 +65,13 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { global } - pub fn declare_cfn(&self, name: &str, _fn_type: Type<'gcc>) -> RValue<'gcc> { + pub fn declare_entry_fn(&self, name: &str, _fn_type: Type<'gcc>, callconv: () /*llvm::CCallConv*/) -> RValue<'gcc> { // TODO(antoyo): use the fn_type parameter. let const_string = self.context.new_type::<u8>().make_pointer().make_pointer(); let return_type = self.type_i32(); let variadic = false; self.linkage.set(FunctionType::Exported); - let func = declare_raw_fn(self, name, () /*llvm::CCallConv*/, return_type, &[self.type_i32(), const_string], variadic); + let func = declare_raw_fn(self, name, callconv, return_type, &[self.type_i32(), const_string], variadic); // NOTE: it is needed to set the current_func here as well, because get_fn() is not called // for the main function. *self.current_func.borrow_mut() = Some(func); |
