summaryrefslogtreecommitdiffstats
path: root/vendor/ar_archive_writer/src/archive.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
commit4547b622d8d29df964fa2914213088b148c498fc (patch)
tree9fc6b25f3c3add6b745be9a2400a6e96140046e9 /vendor/ar_archive_writer/src/archive.rs
parentReleasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz
rustc-4547b622d8d29df964fa2914213088b148c498fc.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/ar_archive_writer/src/archive.rs')
-rw-r--r--vendor/ar_archive_writer/src/archive.rs71
1 files changed, 71 insertions, 0 deletions
diff --git a/vendor/ar_archive_writer/src/archive.rs b/vendor/ar_archive_writer/src/archive.rs
new file mode 100644
index 000000000..0bc4111c6
--- /dev/null
+++ b/vendor/ar_archive_writer/src/archive.rs
@@ -0,0 +1,71 @@
+// Derived from code in LLVM, which is:
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+// Derived from https://github.com/llvm/llvm-project/blob/8ef3e895ad8ab1724e2b87cabad1dacdc7a397a3/llvm/include/llvm/Object/Archive.h
+
+/// Size field is 10 decimal digits long
+pub(crate) const MAX_MEMBER_SIZE: u64 = 9999999999;
+
+#[derive(Copy, Clone, Debug, PartialEq)]
+pub enum ArchiveKind {
+ Gnu,
+ Gnu64,
+ Bsd,
+ Darwin,
+ Darwin64,
+ Coff,
+ AixBig,
+}
+
+pub(crate) mod big_archive {
+ #[repr(C)]
+ pub(crate) struct BigArMemHdrType {
+ /// File member size in decimal
+ size: [u8; 20],
+
+ /// Next member offset in decimal
+ next_offset: [u8; 20],
+
+ /// Previous member offset in decimal
+ prev_offset: [u8; 20],
+
+ last_modified: [u8; 12],
+
+ uid: [u8; 12],
+ gid: [u8; 12],
+
+ access_mode: [u8; 12],
+
+ /// File member name length in decimal
+ name_len: [u8; 4],
+
+ terminator: [u8; 2],
+ }
+
+ /// Fixed-Length Header.
+ #[repr(C)]
+ pub(crate) struct FixLenHdr {
+ /// Big archive magic string.
+ magic: [u8; 8],
+
+ /// Offset to member table.
+ mem_offset: [u8; 20],
+
+ /// Offset to global symbol table.
+ glob_sym_offset: [u8; 20],
+
+ /// Offset global symbol table for 64-bit objects.
+ glob_sym64_offset: [u8; 20],
+
+ /// Offset to first archive member.
+ first_child_offset: [u8; 20],
+
+ /// Offset to last archive member.
+ last_child_offset: [u8; 20],
+
+ /// Offset to first mem on free list.
+ free_offset: [u8; 20],
+ }
+}