1// Derived from code in LLVM, which is:
2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3// See https://llvm.org/LICENSE.txt for license information.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
6/// Size field is 10 decimal digits long
7pub(crate) const MAX_MEMBER_SIZE: u64 = 9999999999;
8
9#[derive(Copy, Clone, Debug, PartialEq)]
10pub enum ArchiveKind {
11 Gnu,
12 Gnu64,
13 Bsd,
14 Darwin,
15 Darwin64,
16 Coff,
17 AixBig,
18}
19
20pub(crate) mod big_archive {
21 #[repr(C)]
22 pub(crate) struct BigArMemHdrType {
23 /// File member size in decimal
24 size: [u8; 20],
25
26 /// Next member offset in decimal
27 next_offset: [u8; 20],
28
29 /// Previous member offset in decimal
30 prev_offset: [u8; 20],
31
32 last_modified: [u8; 12],
33
34 uid: [u8; 12],
35 gid: [u8; 12],
36
37 access_mode: [u8; 12],
38
39 /// File member name length in decimal
40 name_len: [u8; 4],
41
42 terminator: [u8; 2],
43 }
44
45 /// Fixed-Length Header.
46 #[repr(C)]
47 pub(crate) struct FixLenHdr {
48 /// Big archive magic string.
49 magic: [u8; 8],
50
51 /// Offset to member table.
52 mem_offset: [u8; 20],
53
54 /// Offset to global symbol table.
55 glob_sym_offset: [u8; 20],
56
57 /// Offset global symbol table for 64-bit objects.
58 glob_sym64_offset: [u8; 20],
59
60 /// Offset to first archive member.
61 first_child_offset: [u8; 20],
62
63 /// Offset to last archive member.
64 last_child_offset: [u8; 20],
65
66 /// Offset to first mem on free list.
67 free_offset: [u8; 20],
68 }
69}
70

Provided by KDAB

Privacy Policy
Learn Rust with the experts
Find out more