Skip to content

Commit 504d89a

Browse files
authored
Merge pull request #18 from rust-lang/big_endian_fixes
Fix building for big-endian systems
2 parents 29436ce + a0eb44c commit 504d89a

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
- name: Test
1919
run: |
2020
cargo test
21+
- name: Check (big-endian)
22+
run: |
23+
rustup target add powerpc64-unknown-linux-gnu
24+
cargo check --target powerpc64-unknown-linux-gnu
2125
2226
fmt:
2327
name: rustfmt

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ar_archive_writer"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
edition = "2021"
55
license = "Apache-2.0 WITH LLVM-exception"
66
description = "A writer for object file ar archives"

src/coff_import_file.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ pub(crate) const NULL_THUNK_DATA_SUFFIX: &[u8] = b"_NULL_THUNK_DATA";
3131

3232
macro_rules! u16 {
3333
($val:expr) => {
34-
object::U16::new(object::NativeEndian, $val)
34+
object::U16::new(object::LittleEndian, $val)
3535
};
3636
}
3737

3838
macro_rules! u32 {
3939
($val:expr) => {
40-
object::U32::new(object::NativeEndian, $val)
40+
object::U32::new(object::LittleEndian, $val)
4141
};
4242
}
4343

@@ -49,7 +49,7 @@ pub(crate) fn get_short_import_symbol(
4949
let mut offset = 0;
5050
let header = ImportObjectHeader::parse(buf, &mut offset).map_err(Error::other)?;
5151
let data = header.parse_data(buf, &mut offset).map_err(Error::other)?;
52-
let is_ec = header.machine.get(object::NativeEndian) == object::pe::IMAGE_FILE_MACHINE_ARM64EC;
52+
let is_ec = header.machine.get(object::LittleEndian) == object::pe::IMAGE_FILE_MACHINE_ARM64EC;
5353

5454
let name = data.symbol();
5555
let demangled_name = is_ec
@@ -77,7 +77,7 @@ pub(crate) fn get_short_import_symbol(
7777
f(demangled_name.as_ref())?;
7878

7979
// For Arm64EC, also the EC import symbol and thunk.
80-
if header.machine.get(object::NativeEndian) == object::pe::IMAGE_FILE_MACHINE_ARM64EC {
80+
if header.machine.get(object::LittleEndian) == object::pe::IMAGE_FILE_MACHINE_ARM64EC {
8181
const IMP_PREFIX: &[u8] = b"__imp_aux_";
8282
f(&IMP_PREFIX
8383
.iter()

0 commit comments

Comments
 (0)