Skip to content

Commit 1185cf6

Browse files
committed
Move reference files into their own directory
1 parent c632d0c commit 1185cf6

File tree

9 files changed

+22
-21
lines changed

9 files changed

+22
-21
lines changed

Readme.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# A writer for object file ar archives
22

3-
This is a Rust port of LLVM's archive writer (`ArchiveWriter.cpp`):
4-
* Based on commit [8ef3e895a](https://github.com/llvm/llvm-project/tree/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2) (15.0.0-rc3).
5-
* With the following options removed:
6-
* Deterministic: always enabled.
7-
* Symbol tables: always enabled.
3+
This is a Rust port of LLVM's archive writer (see [the LLVM Reference](reference/Readme.md)
4+
for details) with the following options removed:
5+
* Deterministic: always enabled.
6+
* Symbol tables: always enabled.
87

98
## License
109

src/Alignment.h renamed to reference/Alignment.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Copied from https://github.com/llvm/llvm-project/blob/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2/llvm/include/llvm/Support/Alignment.h
2-
31
//===-- llvm/Support/Alignment.h - Useful alignment functions ---*- C++ -*-===//
42
//
53
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

src/Archive.h renamed to reference/Archive.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Copied from https://github.com/llvm/llvm-project/blob/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2/llvm/include/llvm/Object/Archive.h
2-
31
//===- Archive.h - ar archive file format -----------------------*- C++ -*-===//
42
//
53
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

src/ArchiveWriter.cpp renamed to reference/ArchiveWriter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Copied from https://github.com/llvm/llvm-project/blob/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2/llvm/lib/Object/ArchiveWriter.cpp
2-
31
//===- ArchiveWriter.cpp - ar File Format implementation --------*- C++ -*-===//
42
//
53
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

src/ArchiveWriter.h renamed to reference/ArchiveWriter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Copied from https://github.com/llvm/llvm-project/blob/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2/llvm/include/llvm/Object/ArchiveWriter.h
2-
31
//===- ArchiveWriter.h - ar archive file format writer ----------*- C++ -*-===//
42
//
53
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

reference/Readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# LLVM Reference Files
2+
3+
These are a copy of the relevant LLVM files that were ported to Rust from the
4+
last time that this project was "synced" with LLVM.
5+
6+
Currently that sync point is 15.0.0-rc3, commit [8ef3e895a](https://github.com/llvm/llvm-project/tree/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2).
7+
8+
These files were originally located at:
9+
* `llvm/include/llvm/Support/Alignment.h`
10+
* `llvm/include/llvm/Object/Archive.h`
11+
* `llvm/include/llvm/Object/ArchiveWriter.h`
12+
* `llvm/lib/Object/ArchiveWriter.cpp`
13+
14+
When syncing, make sure to update these files and the commit above.
15+
16+
Additionally, `ar_archive_writer` has removed some options, so you can assume:
17+
* `deterministic` is always `true`.
18+
* `write_symtab` is always `true`.

src/alignment.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// See https://llvm.org/LICENSE.txt for license information.
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
// Derived from https://github.com/llvm/llvm-project/blob/8ef3e895ad8ab1724e2b87cabad1dacdc7a397a3/llvm/include/llvm/Support/Alignment.h
7-
86
/// Returns a multiple of `align` needed to store `size` bytes.
97
pub(crate) fn align_to(size: u64, align: u64) -> u64 {
108
(size + align - 1) & !(align - 1)

src/archive.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// See https://llvm.org/LICENSE.txt for license information.
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
// Derived from https://github.com/llvm/llvm-project/blob/8ef3e895ad8ab1724e2b87cabad1dacdc7a397a3/llvm/include/llvm/Object/Archive.h
7-
86
/// Size field is 10 decimal digits long
97
pub(crate) const MAX_MEMBER_SIZE: u64 = 9999999999;
108

src/archive_writer.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77

8-
// Derived from:
9-
// * https://github.com/llvm/llvm-project/blob/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2/llvm/include/llvm/Object/ArchiveWriter.h
10-
// * https://github.com/llvm/llvm-project/blob/3d3ef9d073e1e27ea57480b371b7f5a9f5642ed2/llvm/lib/Object/ArchiveWriter.cpp
11-
128
use std::collections::HashMap;
139
use std::io::{self, Cursor, Seek, Write};
1410

0 commit comments

Comments
 (0)