Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 5a41555

Browse files
author
Peter Huene
committed
Address code review feedback.
* Disable default features for the `byteorder` crate. * Add a comment regarding the Windows ABI unwind code numerical values. * Panic if we encounter a Windows function with a prologue greater than 256 bytes in size.
1 parent 63461ed commit 5a41555

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

cranelift-codegen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ target-lexicon = "0.8.1"
2323
log = { version = "0.4.6", default-features = false }
2424
serde = { version = "1.0.94", features = ["derive"], optional = true }
2525
smallvec = { version = "0.6.10" }
26-
byteorder = "1.3.2"
26+
byteorder = { version = "1.3.2", default-features = false }
2727
# It is a goal of the cranelift-codegen crate to have minimal external dependencies.
2828
# Please don't add any unless they are essential to the task of creating binary
2929
# machine code. Integration tests that need external dependencies can be

cranelift-codegen/src/isa/x86/unwind.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl UnwindInfo {
118118
for (offset, inst, size) in func.inst_offsets(entry_block, &isa.encoding_info()) {
119119
// x64 ABI prologues cannot exceed 256 bytes in length
120120
if (offset + size) > 256 {
121-
return None;
121+
panic!("function prologues cannot exceed 256 bytes in size for Windows x64");
122122
}
123123

124124
prologue_size += size;
@@ -399,7 +399,7 @@ mod tests {
399399
let mut mem = Vec::new();
400400
unwind
401401
.emit(&mut mem)
402-
.expect("failed to emit unwind information");;
402+
.expect("failed to emit unwind information");
403403

404404
assert_eq!(
405405
mem,
@@ -465,7 +465,7 @@ mod tests {
465465
let mut mem = Vec::new();
466466
unwind
467467
.emit(&mut mem)
468-
.expect("failed to emit unwind information");;
468+
.expect("failed to emit unwind information");
469469

470470
assert_eq!(
471471
mem,

cranelift-filetests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ log = "0.4.6"
2020
memmap = "0.7.0"
2121
num_cpus = "1.8.0"
2222
region = "2.1.2"
23-
byteorder = "1.3.2"
23+
byteorder = { version = "1.3.2", default-features = false }
2424

2525
[features]
2626
basic-blocks = []

cranelift-filetests/src/test_unwind.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ enum UnwindOperation {
174174

175175
impl From<u8> for UnwindOperation {
176176
fn from(value: u8) -> Self {
177+
// The numerical value is specified as part of the Windows x64 ABI
177178
match value {
178179
0 => Self::PushNonvolatileRegister,
179180
1 => Self::LargeStackAlloc,

0 commit comments

Comments
 (0)