mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
link/Elf.zig: ensure capacity before appending linker args.
fixes e567abb339e1edaf5a3c86fe632522a3b8005275 "rework linker inputs" closes https://github.com/ziglang/zig/issues/21801
This commit is contained in:
parent
b1361f237a
commit
6a364b4a5e
@ -1962,7 +1962,8 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
|
|||||||
if (is_exe_or_dyn_lib) {
|
if (is_exe_or_dyn_lib) {
|
||||||
// Worst-case, we need an --as-needed argument for every lib, as well
|
// Worst-case, we need an --as-needed argument for every lib, as well
|
||||||
// as one before and one after.
|
// as one before and one after.
|
||||||
try argv.append("--as-needed");
|
try argv.ensureUnusedCapacity(2 * self.base.comp.link_inputs.len + 2);
|
||||||
|
argv.appendAssumeCapacity("--as-needed");
|
||||||
var as_needed = true;
|
var as_needed = true;
|
||||||
|
|
||||||
for (self.base.comp.link_inputs) |link_input| switch (link_input) {
|
for (self.base.comp.link_inputs) |link_input| switch (link_input) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user