Skip to content

Commit d044e73

Browse files
authored
Miscellaneous documentation cleanups. (#89)
1 parent 3477cb3 commit d044e73

12 files changed

Lines changed: 40 additions & 39 deletions

File tree

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ its own implementations of this functionality, written in Rust.
2424

2525
For a C-ABI-compatible interface to this functionality, see [c-scape].
2626

27-
This is used by [Mustang] and [Eyra] in their libc implementations, and in
28-
the [Origin Studio] project in its std implementation, which are three different
27+
This is used by [Mustang] and [Eyra] in their libc implementations, and in the
28+
[Origin Studio] project in its std implementation, which are three different
2929
ways to support building Rust programs written entirely in Rust.
3030

3131
## Example crates
@@ -51,9 +51,9 @@ Origin can also be used on its own, in several different configurations:
5151

5252
- The [origin-start-no-alloc example] is like origin-start, but disables the
5353
"alloc" and "thread" features, since Origin's "thread" feature currently
54-
depends on "alloc". Without "alloc", functions that return owned strings
55-
or `Vec`s are not available. In this mode, Origin avoids using a
56-
global allocator entirely.
54+
depends on "alloc". Without "alloc", functions that return owned strings or
55+
`Vec`s are not available. In this mode, Origin avoids using a global
56+
allocator entirely.
5757

5858
- The [origin-start-lto example] is like origin-start, but builds with LTO.
5959

@@ -69,14 +69,15 @@ default they do still depend on a dynamic linker.
6969

7070
For fully static linking, there are two options:
7171

72-
- Build with `RUSTFLAGS=-C target-feature=+crt-static -C relocation-model=static`.
73-
This disables PIE mode, which is safer in terms of Origin's code, but loses
74-
the security benefits of Address-Space Layout Randomization (ASLR).
72+
- Build with
73+
`RUSTFLAGS=-C target-feature=+crt-static -C relocation-model=static`. This
74+
disables PIE mode, which is safer in terms of Origin's code, but loses the
75+
security benefits of Address-Space Layout Randomization (ASLR).
7576

76-
- Build with `RUSTFLAGS=-C target-feature=+crt-static` and enable
77-
Origin's `experimental-relocate` feature. This allows PIE mode to work,
78-
however it does so by enabling some highly experimental code in origin for
79-
performing relocations.
77+
- Build with `RUSTFLAGS=-C target-feature=+crt-static` and enable Origin's
78+
`experimental-relocate` feature. This allows PIE mode to work, however it
79+
does so by enabling some experimental code in origin for performing
80+
relocations.
8081

8182
[basic example]: https://github.com/sunfishcode/origin/blob/main/example-crates/basic/README.md
8283
[no-std example]: https://github.com/sunfishcode/origin/blob/main/example-crates/no-std/README.md

example-crates/tiny/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ instructions are `origin::program::entry` and everything, including the user
197197

198198
## Optimizations not done
199199

200-
In theory this code code be made even smaller.
200+
In theory this code be made even smaller.
201201

202202
That first `mov $rsp,%rdi` is moving the incoming stack pointer we got from the
203203
OS into the first argument register to pass to `origin::program::entry` so that

src/arch/aarch64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ pub(super) unsafe fn relocation_store(ptr: usize, value: usize) {
9494
);
9595
}
9696

97-
/// Mark "relro" memory as readonly.
97+
/// Mark relro memory as readonly.
9898
///
99-
/// "relro" is a relocation feature in which memory can be readonly after
99+
/// relro is a relocation feature in which memory can be readonly after
100100
/// relocations are applied.
101101
///
102102
/// This function conceptually casts `ptr` to a `*mut c_void` and does a
103103
/// `rustix::mm::mprotect(ptr, len, MprotectFlags::READ)`. However, it does
104104
/// this using `asm` and `usize` types which don't carry provenance, as it's
105-
/// used by `relocate` to implement the "relro" feature which cannot be
105+
/// used by `relocate` to implement the relro feature which cannot be
106106
/// expressed in the Rust memory model.
107107
///
108108
/// # Safety

src/arch/arm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ pub(super) unsafe fn relocation_store(ptr: usize, value: usize) {
9494
);
9595
}
9696

97-
/// Mark "relro" memory as readonly.
97+
/// Mark relro memory as readonly.
9898
///
99-
/// "relro" is a relocation feature in which memory can be readonly after
99+
/// relro is a relocation feature in which memory can be readonly after
100100
/// relocations are applied.
101101
///
102102
/// This function conceptually casts `ptr` to a `*mut c_void` and does a
103103
/// `rustix::mm::mprotect(ptr, len, MprotectFlags::READ)`. However, it does
104104
/// this using `asm` and `usize` types which don't carry provenance, as it's
105-
/// used by `relocate` to implement the "relro" feature which cannot be
105+
/// used by `relocate` to implement the relro feature which cannot be
106106
/// expressed in the Rust memory model.
107107
///
108108
/// # Safety

src/arch/riscv64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ pub(super) unsafe fn relocation_store(ptr: usize, value: usize) {
9494
);
9595
}
9696

97-
/// Mark "relro" memory as readonly.
97+
/// Mark relro memory as readonly.
9898
///
99-
/// "relro" is a relocation feature in which memory can be readonly after
99+
/// relro is a relocation feature in which memory can be readonly after
100100
/// relocations are applied.
101101
///
102102
/// This function conceptually casts `ptr` to a `*mut c_void` and does a
103103
/// `rustix::mm::mprotect(ptr, len, MprotectFlags::READ)`. However, it does
104104
/// this using `asm` and `usize` types which don't carry provenance, as it's
105-
/// used by `relocate` to implement the "relro" feature which cannot be
105+
/// used by `relocate` to implement the relro feature which cannot be
106106
/// expressed in the Rust memory model.
107107
///
108108
/// # Safety

src/arch/x86.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ pub(super) unsafe fn relocation_store(ptr: usize, value: usize) {
9999
);
100100
}
101101

102-
/// Mark "relro" memory as readonly.
102+
/// Mark relro memory as readonly.
103103
///
104-
/// "relro" is a relocation feature in which memory can be readonly after
104+
/// relro is a relocation feature in which memory can be readonly after
105105
/// relocations are applied.
106106
///
107107
/// This function conceptually casts `ptr` to a `*mut c_void` and does a
108108
/// `rustix::mm::mprotect(ptr, len, MprotectFlags::READ)`. However, it does
109109
/// this using `asm` and `usize` types which don't carry provenance, as it's
110-
/// used by `relocate` to implement the "relro" feature which cannot be
110+
/// used by `relocate` to implement the relro feature which cannot be
111111
/// expressed in the Rust memory model.
112112
///
113113
/// # Safety

src/arch/x86_64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ pub(super) unsafe fn relocation_store(ptr: usize, value: usize) {
9595
);
9696
}
9797

98-
/// Mark "relro" memory as readonly.
98+
/// Mark relro memory as readonly.
9999
///
100-
/// "relro" is a relocation feature in which memory can be readonly after
100+
/// relro is a relocation feature in which memory can be readonly after
101101
/// relocations are applied.
102102
///
103103
/// This function conceptually casts `ptr` to a `*mut c_void` and does a
104104
/// `rustix::mm::mprotect(ptr, len, MprotectFlags::READ)`. However, it does
105105
/// this using `asm` and `usize` types which don't carry provenance, as it's
106-
/// used by `relocate` to implement the "relro" feature which cannot be
106+
/// used by `relocate` to implement the relro feature which cannot be
107107
/// expressed in the Rust memory model.
108108
///
109109
/// # Safety

src/program.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub fn at_exit(func: Box<dyn FnOnce() + Send>) {
242242
use core::ffi::c_void;
243243

244244
extern "C" {
245-
// <https://refspecs.linuxbase.org/LSB_3.1.0/LSB-generic/LSB-generic/baselib---cxa-atexit.html>
245+
// <https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---cxa-atexit.html>
246246
fn __cxa_atexit(
247247
func: unsafe extern "C" fn(*mut c_void),
248248
arg: *mut c_void,

src/signal/libc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub unsafe fn sigaction(sig: Signal, action: Option<Sigaction>) -> io::Result<Si
3939
}
4040
}
4141

42-
/// Return a special "ignore" signal handler for ignoring signals.
42+
/// Return a special ignore signal handler for ignoring signals.
4343
///
4444
/// If you're looking for `sig_dfl`; use [`SigDfl`].
4545
#[doc(alias = "SIG_IGN")]
@@ -48,8 +48,8 @@ pub const fn sig_ign() -> Sighandler {
4848
libc::SIG_IGN
4949
}
5050

51-
/// A special "default" signal handler representing the default behavior for
52-
/// handling a signal.
51+
/// A special default signal handler representing the default behavior
52+
/// for handling a signal.
5353
///
5454
/// If you're looking for `SigIgn`; use [`sig_ign`].
5555
#[doc(alias = "SIG_DFL")]

src/signal/linux_raw.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub unsafe fn sigaction(sig: Signal, action: Option<Sigaction>) -> io::Result<Si
4343
rustix::runtime::sigaction(sig, action)
4444
}
4545

46-
/// Return a special "ignore" signal handler for ignoring signals.
46+
/// Return a special ignore signal handler for ignoring signals.
4747
///
4848
/// If you're looking for `sig_dlf`; use [`SigDfl`].
4949
#[doc(alias = "SIG_IGN")]
@@ -52,8 +52,8 @@ pub const fn sig_ign() -> Sighandler {
5252
linux_raw_sys::signal_macros::sig_ign()
5353
}
5454

55-
/// A special "default" signal handler representing the default behavior for
56-
/// handling a signal.
55+
/// A special default signal handler representing the default behavior
56+
/// for handling a signal.
5757
///
5858
/// If you're looking for `SigIgn`; use [`sig_ign`].
5959
#[doc(alias = "SIG_DFL")]

0 commit comments

Comments
 (0)