Skip to content

Commit

Permalink
nix-ld: fix build with Rust 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
K900 committed Dec 17, 2024
1 parent f75a363 commit 0e33fa2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkgs/by-name/ni/nix-ld/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ rustPlatform.buildRustPackage rec {
hash = "sha256-NRkLjdMtVfC6dD1gEbYZWFEtbmC2xfD6ft1IP7l76Vw=";
};

patches = [ ./rust-1.83.patch ];

cargoHash = "sha256-GOngDGRzWVuzGTX5xNb/nv5dJ6is6cH8K6kHTX3OoXE=";

hardeningDisable = [ "stackprotector" ];
Expand Down
36 changes: 36 additions & 0 deletions pkgs/by-name/ni/nix-ld/rust-1.83.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- a/src/arch.rs
+++ b/src/arch.rs
@@ -142,7 +142,7 @@ cfg_match! {

#[naked]
unsafe extern "C" fn entry_trampoline() -> ! {
- core::arch::asm!(
+ core::arch::naked_asm!(
"lea r10, [rip + {context}]",
"mov r11, [r10 + {size} * 1]", // .env_entry
"test r11, r11",
@@ -153,7 +153,6 @@ cfg_match! {
"jmp [rip + {context}]",
context = sym TRAMPOLINE_CONTEXT,
size = const core::mem::size_of::<*const u8>(),
- options(noreturn),
)
}
}
@@ -162,7 +161,7 @@ cfg_match! {

#[naked]
unsafe extern "C" fn entry_trampoline() -> ! {
- core::arch::asm!(
+ core::arch::naked_asm!(
"adrp x8, {context}",
"ldr x9, [x8, {env_entry_off}]", // .env_entry
"cbz x9, 2f",
@@ -174,7 +173,6 @@ cfg_match! {
context = sym TRAMPOLINE_CONTEXT,
env_entry_off = const TrampolineContext::ENV_ENTRY_OFFSET,
env_string_off = const TrampolineContext::ENV_STRING_OFFSET,
- options(noreturn),
)
}
}

0 comments on commit 0e33fa2

Please sign in to comment.