Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app-admin/oma/autobuild/defines
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ PKGREP="mirrormgr<=0.11.1"

USECLANG=1
PKGESS=1

# FIXME: LTO will cause unexpected lsx generation
NOLTO__LOONGARCH64_NOSIMD=1
2 changes: 1 addition & 1 deletion app-admin/oma/spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VER=1.20.1
REL=1
REL=2
SRCS="git::commit=tags/v${VER/\~/-}::https://github.com/AOSC-Dev/oma"
CHKSUMS="SKIP"
CHKUPDATE="anitya::id=328412"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c62e1c6dcc6eeb8db7619b6e30e00657b98f5162 Mon Sep 17 00:00:00 2001
From: Jiajie Chen <[email protected]>
Date: Fri, 9 Feb 2024 18:48:33 -0800
Subject: [PATCH 1/3] Add i486-unknown-linux-gnu compiler target
Subject: [PATCH 1/4] Add i486-unknown-linux-gnu compiler target

---
compiler/rustc_target/src/spec/mod.rs | 1 +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From d775cc8d435c34ad5147161c5082775bc1a0f45b Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <[email protected]>
Date: Thu, 7 Aug 2025 20:12:53 +0200
Subject: [PATCH 2/3] ARCHLINUX: compiler: Swap primary and secondary lib dirs
Subject: [PATCH 2/4] ARCHLINUX: compiler: Swap primary and secondary lib dirs

Arch Linux (editor's note: also AOSC OS) prefers "lib" over "lib64".
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 4558c3cef1db12eb171c992e12c88a53b79101ed Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <[email protected]>
Date: Thu, 7 Aug 2025 19:01:26 +0200
Subject: [PATCH 3/3] ARCHLINUX: bootstrap: Workaround for system stage0
Subject: [PATCH 3/4] ARCHLINUX: bootstrap: Workaround for system stage0

See: https://github.com/rust-lang/rust/issues/143735
---
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
From 874b53e68456b421b3a0bf7e2f48a2390758e71d Mon Sep 17 00:00:00 2001
From: WANG Rui <[email protected]>
Date: Wed, 3 Sep 2025 11:34:15 +0800
Subject: [PATCH 4/4] compiler: Apply target features to the entry function

---
compiler/rustc_codegen_llvm/src/attributes.rs | 21 ++++++++++++-------
compiler/rustc_codegen_llvm/src/context.rs | 8 +++++--
2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs
index adb53e0b66..3313b1f4c4 100644
--- a/compiler/rustc_codegen_llvm/src/attributes.rs
+++ b/compiler/rustc_codegen_llvm/src/attributes.rs
@@ -302,6 +302,19 @@ pub(crate) fn tune_cpu_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribu
.map(|tune_cpu| llvm::CreateAttrStringValue(cx.llcx, "tune-cpu", tune_cpu))
}

+/// Get the `target-features` LLVM attribute.
+pub(crate) fn target_features_attr<'ll>(
+ cx: &CodegenCx<'ll, '_>,
+ function_features: Vec<String>,
+) -> Option<&'ll Attribute> {
+ let global_features = cx.tcx.global_backend_features(()).iter().map(String::as_str);
+ let function_features = function_features.iter().map(String::as_str);
+ let target_features =
+ global_features.chain(function_features).intersperse(",").collect::<String>();
+ (!target_features.is_empty())
+ .then(|| llvm::CreateAttrStringValue(cx.llcx, "target-features", &target_features))
+}
+
/// Get the `NonLazyBind` LLVM attribute,
/// if the codegen options allow skipping the PLT.
pub(crate) fn non_lazy_bind_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
@@ -535,13 +548,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
}
}

- let global_features = cx.tcx.global_backend_features(()).iter().map(|s| s.as_str());
- let function_features = function_features.iter().map(|s| s.as_str());
- let target_features: String =
- global_features.chain(function_features).intersperse(",").collect();
- if !target_features.is_empty() {
- to_add.push(llvm::CreateAttrStringValue(cx.llcx, "target-features", &target_features));
- }
+ to_add.extend(target_features_attr(cx, function_features));

attributes::apply_to_llfn(llfn, Function, &to_add);
}
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
index 0324dff6ff..55d335923d 100644
--- a/compiler/rustc_codegen_llvm/src/context.rs
+++ b/compiler/rustc_codegen_llvm/src/context.rs
@@ -822,7 +822,7 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
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() {
- Some(self.declare_entry_fn(
+ let llfn = self.declare_entry_fn(
entry_name,
llvm::CallConv::from_conv(
self.sess().target.entry_abi,
@@ -830,7 +830,11 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
),
llvm::UnnamedAddr::Global,
fn_type,
- ))
+ );
+ if let Some(attr) = attributes::target_features_attr(self, vec![]) {
+ attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[attr])
+ }
+ Some(llfn)
} else {
// If the symbol already exists, it is an error: for example, the user wrote
// #[no_mangle] extern "C" fn main(..) {..}
--
2.51.0

2 changes: 1 addition & 1 deletion lang-rust/rustc/spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VER=1.89.0
REL=1
REL=2
# Note: Uncomment this if we have the last version built and ready.
SRCS="tbl::https://static.rust-lang.org/dist/rustc-${VER}-src.tar.xz"
CHKSUMS="sha256::0b9d55610d8270e06c44f459d1e2b7918a5e673809c592abed9b9c600e33d95a"
Expand Down