Remove unused bookkeeping fields

This commit is contained in:
Rui Ueyama committed 2026-09-14 22:54:34 +09:00
1 parent 4f04b640a8
commit a21598f0ef
6 files changed
+4 -25

No files matched your search

-3
View File
@@ -178,10 +178,7 @@ pub fn construct<E: Arch>(ctx: &mut Context<E>) {
}
// Assign FDE offsets to files.
let mut idx = 0u64;
for file in &mut ctx.objs {
file.fde_idx = idx;
idx += file.fdes.len() as u64;
file.fde_offset = offset;
offset += file.fde_size;
}
+2 -11
View File
@@ -473,7 +473,6 @@ pub struct Args {
pub undefined_version: bool,
pub use_android_relr_tags: bool,
pub warn_common: bool,
pub warn_once: bool,
pub warn_textrel: bool,
pub z_copyreloc: bool,
pub z_delete: bool,
@@ -616,7 +615,6 @@ impl Default for Args {
undefined_version: false,
use_android_relr_tags: false,
warn_common: false,
warn_once: false,
warn_textrel: false,
z_copyreloc: true,
z_delete: true,
@@ -1035,9 +1033,6 @@ fn returns_etxtbsy() -> bool {
pub struct ParsedArgs {
pub args: Args,
pub jobs: Vec<ReaderJob>,
/// The reader state at the end of the command line; `-static` there
/// means a static link.
pub final_rctx: ReaderContext,
}
/// Parses all options. `cmdline` includes the program name.
@@ -1485,7 +1480,7 @@ pub fn parse_args(target: &TargetTraits, raw_cmdline: &[OsString]) -> ParsedArgs
} else if read_flag!("no-warn-common") {
a.warn_common = false;
} else if read_flag!("warn-once") {
a.warn_once = true;
// Ignored for GNU ld compatibility, as in C++ mold.
} else if read_flag!("warn-shared-textrel") {
warn_shared_textrel = true;
} else if read_flag!("warn-textrel") {
@@ -2203,11 +2198,7 @@ pub fn parse_args(target: &TargetTraits, raw_cmdline: &[OsString]) -> ParsedArgs
a.dynamic_linker.clear();
}
ParsedArgs {
args: a,
jobs,
final_rctx: rctx,
}
ParsedArgs { args: a, jobs }
}
fn add_rpath<'a>(a: &mut Args, seen: &mut HashSet<&'a OsStr>, path: &'a OsStr) {
+1 -7
View File
@@ -4,7 +4,7 @@
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::path::Path;
use std::sync::atomic::{AtomicBool, AtomicU32};
use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Mutex, MutexGuard, OnceLock};
use crate::arch::Arch;
@@ -216,7 +216,6 @@ pub struct Context<E: Arch> {
pub needs_tlsld: AtomicBool,
pub has_textrel: AtomicBool,
pub num_ifunc_dynrels: AtomicU32,
pub undef_errors: Mutex<HashMap<SymbolId, Vec<String>>>,
@@ -231,9 +230,6 @@ pub struct Context<E: Arch> {
pub dtp_addr: u64,
pub syms: SyntheticSymbols,
/// The size of the output file once the layout is fixed.
pub filesize: u64,
}
impl<E: Arch> Context<E> {
@@ -320,7 +316,6 @@ impl<E: Arch> Context<E> {
comment: None,
needs_tlsld: AtomicBool::new(false),
has_textrel: AtomicBool::new(false),
num_ifunc_dynrels: AtomicU32::new(0),
undef_errors: Mutex::new(HashMap::new()),
version_patterns: Vec::new(),
dynamic_list_patterns: Vec::new(),
@@ -330,7 +325,6 @@ impl<E: Arch> Context<E> {
tp_addr: 0,
dtp_addr: 0,
syms,
filesize: 0,
}
}
-1
View File
@@ -581,7 +581,6 @@ pub fn link<E: Arch>(cmdline: &[std::ffi::OsString]) -> Result<i32, &'static str
let t = ctx.timer("update_reldyn");
chunks::reldyn::update_shdr(&mut ctx);
drop(t);
ctx.filesize = filesize;
t_before_copy.stop();
// Create an output file
-2
View File
@@ -848,7 +848,6 @@ pub struct ObjectFile<E: Arch> {
pub has_ctors: bool,
// Output .eh_frame layout
pub fde_idx: u64,
pub fde_offset: u64,
pub fde_size: u64,
@@ -1186,7 +1185,6 @@ impl<E: Arch> ObjectFile<E> {
is_dwarf32: false,
has_init_array: false,
has_ctors: false,
fde_idx: 0,
fde_offset: 0,
fde_size: 0,
llvm_addrsig: None,
+1 -1
View File
@@ -4038,7 +4038,7 @@ pub fn set_osec_offsets<E: Arch>(ctx: &mut Context<E>) -> u64 {
}
fn num_irelative_relocs<E: Arch>(ctx: &Context<E>) -> u64 {
let mut n = ctx.num_ifunc_dynrels.load(Ordering::Relaxed) as u64;
let mut n = 0u64;
n += ctx
.got
.got_syms